# Error Login HF. Create Token error?

**URL:** <https://discuss.huggingface.co/t/error-login-hf-create-token-error/176889>\
**Category:** Beginners\
**Created:** [June 17, 2026, 12:15pm UTC](https://discuss.huggingface.co/t/error-login-hf-create-token-error/176889 "2026-06-17T12:15:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vitinello](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/vitinello/32/60897_2.png) [@Vitinello](https://discuss.huggingface.co/u/Vitinello)\
**Post date:** [June 17, 2026, 12:15pm UTC](https://discuss.huggingface.co/t/error-login-hf-create-token-error/176889/1 "2026-06-17T12:15:03Z")

</div>

I can’t log in due to the following error, any help please

```auto
    To log in, `huggingface_hub` requires a token generated from https://huggingface.co/settings/tokens .
Token can be pasted using 'Right-Click'.
Enter your token (input will not be visible):
Add token as git credential? [y/N]: y
Error: (Amz CF ID: SoCIN4FdRKB4Aftxnh2rChFGXpYI6AVGNMzuqPQhm_zT6pENSVpejw==)

Bad request:
Set HF_DEBUG=1 as environment variable for full traceback.

```

---

<div class="post-metadata">

**Author:** ![Vitinello](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/vitinello/32/60897_2.png) [@Vitinello](https://discuss.huggingface.co/u/Vitinello)\
**Post date:** [June 17, 2026, 1:32pm UTC](https://discuss.huggingface.co/t/error-login-hf-create-token-error/176889/2 "2026-06-17T13:32:06Z")

</div>

using right click show this:

```auto
    To log in, `huggingface_hub` requires a token generated from https://huggingface.co/settings/tokens .
Token can be pasted using 'Right-Click'.
Enter your token (input will not be visible):
Add token as git credential? [y/N]: y
Token is valid (permission: fineGrained).
The token `sam3` has been saved to C:\Users\Usuario\.cache\huggingface\stored_tokens
Traceback (most recent call last):
  File "C:\Users\Usuario\pixiprojects\geo\.pixi\envs\default\Scripts\hf-script.py", line 10, in <module>
    sys.exit(main())
             ^^^^^^
  File "C:\Users\Usuario\pixiprojects\geo\.pixi\envs\default\Lib\site-packages\huggingface_hub\cli\hf.py", line 116, in main
    app()
  File "C:\Users\Usuario\pixiprojects\geo\.pixi\envs\default\Lib\site-packages\typer\main.py", line 1152, in __call__
    raise e
  File "C:\Users\Usuario\pixiprojects\geo\.pixi\envs\default\Lib\site-packages\typer\main.py", line 1135, in __call__
    return get_command(self)(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Usuario\pixiprojects\geo\.pixi\envs\default\Lib\site-packages\click\core.py", line 1524, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Usuario\pixiprojects\geo\.pixi\envs\default\Lib\site-packages\typer\core.py", line 794, in main
    return _main(
           ^^^^^^
  File "C:\Users\Usuario\pixiprojects\geo\.pixi\envs\default\Lib\site-packages\typer\core.py", line 188, in _main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "C:\Users\Usuario\pixiprojects\geo\.pixi\envs\default\Lib\site-packages\huggingface_hub\cli\_cli_utils.py", line 131, in invoke
    return super().invoke(ctx)
           ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Usuario\pixiprojects\geo\.pixi\envs\default\Lib\site-packages\click\core.py", line 1912, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Usuario\pixiprojects\geo\.pixi\envs\default\Lib\site-packages\huggingface_hub\cli\_cli_utils.py", line 131, in invoke
    return super().invoke(ctx)
           ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Usuario\pixiprojects\geo\.pixi\envs\default\Lib\site-packages\click\core.py", line 1912, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Usuario\pixiprojects\geo\.pixi\envs\default\Lib\site-packages\click\core.py", line 1308, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Usuario\pixiprojects\geo\.pixi\envs\default\Lib\site-packages\click\core.py", line 877, in invoke
    return callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Usuario\pixiprojects\geo\.pixi\envs\default\Lib\site-packages\typer\main.py", line 1514, in wrapper
    return callback(**use_params)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Usuario\pixiprojects\geo\.pixi\envs\default\Lib\site-packages\huggingface_hub\cli\auth.py", line 77, in auth_login
    login(token=token, add_to_git_credential=add_to_git_credential, skip_if_logged_in=not force)
  File "C:\Users\Usuario\pixiprojects\geo\.pixi\envs\default\Lib\site-packages\huggingface_hub\_login.py", line 117, in login
    interpreter_login(skip_if_logged_in=skip_if_logged_in)
  File "C:\Users\Usuario\pixiprojects\geo\.pixi\envs\default\Lib\site-packages\huggingface_hub\_login.py", line 272, in interpreter_login
    _login(token=token, add_to_git_credential=add_to_git_credential)
  File "C:\Users\Usuario\pixiprojects\geo\.pixi\envs\default\Lib\site-packages\huggingface_hub\_login.py", line 387, in _login
    _set_active_token(token_name=token_name, add_to_git_credential=add_to_git_credential)
  File "C:\Users\Usuario\pixiprojects\geo\.pixi\envs\default\Lib\site-packages\huggingface_hub\_login.py", line 434, in _set_active_token
    if _is_git_credential_helper_configured():
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Usuario\pixiprojects\geo\.pixi\envs\default\Lib\site-packages\huggingface_hub\_login.py", line 453, in _is_git_credential_helper_configured
    helpers = list_credential_helpers()
              ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Usuario\pixiprojects\geo\.pixi\envs\default\Lib\site-packages\huggingface_hub\utils\_git_credential.py", line 48, in list_credential_helpers
    output = run_subprocess("git config --list", folder=folder).stdout
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Usuario\pixiprojects\geo\.pixi\envs\default\Lib\site-packages\huggingface_hub\utils\_subprocess.py", line 85, in run_subprocess
    return subprocess.run(
           ^^^^^^^^^^^^^^^
  File "C:\Users\Usuario\pixiprojects\geo\.pixi\envs\default\Lib\subprocess.py", line 548, in run
    with Popen(*popenargs, **kwargs) as process:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Usuario\pixiprojects\geo\.pixi\envs\default\Lib\subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\Usuario\pixiprojects\geo\.pixi\envs\default\Lib\subprocess.py", line 1538, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [WinError 2] El sistema no puede encontrar el archivo especificado

```

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](https://discuss.huggingface.co/u/John6666)\
**Post date:** [June 17, 2026, 11:23pm UTC](https://discuss.huggingface.co/t/error-login-hf-create-token-error/176889/3 "2026-06-17T23:23:30Z")

</div>

Hmm… if this is really a token/account-side issue, you may need to contact HF support ([website@hf.co](mailto:website@hf.co)), but this also looks similar to a known user-side/local-environment case:

* * *

Your second log says:

```plaintext
Token is valid (permission: fineGrained).

```

So the token itself seems to be accepted.

The crash appears to happen **after** that, when the CLI asks:

```plaintext
Add token as git credential? [y/N]:

```

and you answer:

```plaintext
y

```

So I would first try the simplest workaround: log in again, but answer `N` to the Git credential question.

```powershell
hf auth login --force

```

When asked:

```plaintext
Add token as git credential? [y/N]:

```

choose:

```plaintext
N

```

Then check:

```powershell
hf auth whoami

```

If that works, your Hugging Face token/login is probably fine. The remaining issue is likely just the local Git / Git credential setup.

You can also use the explicit CLI option:

```powershell
hf auth login --force --token <YOUR_TOKEN> --no-add-to-git-credential
hf auth whoami

```

Do not post your real token publicly. Use `<YOUR_TOKEN>` only in your local terminal.

The option is documented here:

[Hugging Face CLI docs: `hf auth login`](https://huggingface.co/docs/huggingface_hub/en/package_reference/cli)

The docs describe:

```plaintext
--add-to-git-credential / --no-add-to-git-credential

```

as saving the token to the Git credential helper, useful only if you plan to run Git commands directly.

If you do need direct Git commands such as `git clone`, `git pull`, or `git push`, then check whether Git is available in the same terminal:

```powershell
git --version
where git

```

If those fail, install [Git for Windows](https://git-scm.com/download/win), restart the terminal, and try again.

> **Why I think this is probably Git / credential-helper related**
>
> The useful sequence in your traceback is:
> 
> ```plaintext
> Token is valid (permission: fineGrained).
> The token `sam3` has been saved to C:\Users\Usuario\.cache\huggingface\stored_tokens
> ...
> Add token as git credential? [y/N]: y
> ...
> output = run_subprocess("git config --list", folder=folder).stdout
> ...
> FileNotFoundError: [WinError 2] El sistema no puede encontrar el archivo especificado
> 
> ```
> 
> So the failure does not seem to happen at the “validate token” step.
> 
> It seems to happen later, when `huggingface_hub` tries to inspect the local Git credential configuration. The traceback points to:
> 
> ```plaintext
> git config --list
> 
> ```
> 
> On Windows, `FileNotFoundError: [WinError 2]` often means that the program/path being called cannot be found. In this traceback, the suspicious command is `git`.
> 
> That is why I would check:
> 
> ```powershell
> git --version
> where git
> 
> ```
> 
> from the exact same terminal/environment where you run `hf auth login`.
> 
> Your traceback also shows a pixi environment:
> 
> ```plaintext
> C:\Users\Usuario\pixiprojects\geo\.pixi\envs\default\...
> 
> ```
> 
> So if you are running this inside pixi, it may also be worth checking:
> 
> ```powershell
> pixi run git --version
> pixi run hf auth whoami
> 
> ```
> 
> It is possible for Git to be installed somewhere on Windows but still not visible from the environment that is running Python / `hf`.

> **Similar cases**
>
> This is not exactly the same report, but there are a few similar Hugging Face Forum cases where Windows `WinError 2` / missing-file errors during login were resolved by fixing Git availability.
> 
> | Similar case | Relevant point |
> | --- | --- |
> | [Getting error when trying to log into hugging face account](https://discuss.huggingface.co/t/getting-error-when-trying-to-log-into-hugging-face-account/11719/3) | A user reported that installing Git for Windows and restarting fixed a Windows login error. |
> | [How to login to Huggingface Hub with Access Token](https://discuss.huggingface.co/t/how-to-login-to-huggingface-hub-with-access-token/22498/17) | In an Anaconda/Windows case, installing Git in the environment was suggested for `[WinError 2] File Not Found`, and another user replied that it worked. |
> | [Hugging Face CLI docs: `hf auth login`](https://huggingface.co/docs/huggingface_hub/en/package_reference/cli) | The CLI has a `--no-add-to-git-credential` option, so skipping Git credential storage is a valid diagnostic step when you do not need direct Git commands. |

So I would try this order:

```powershell
git --version
where git
hf auth login --force --token <YOUR_TOKEN> --no-add-to-git-credential
hf auth whoami

```

If that works, then the token/account side is probably OK.

If it still fails even with `--no-add-to-git-credential`, then it may be a different token/account/API issue, and contacting HF support would make more sense.

---

<div class="post-metadata">

**Author:** ![Vitinello](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/vitinello/32/60897_2.png) [@Vitinello](https://discuss.huggingface.co/u/Vitinello)\
**Post date:** [June 18, 2026, 11:03pm UTC](https://discuss.huggingface.co/t/error-login-hf-create-token-error/176889/4 "2026-06-18T23:03:58Z")

</div>

Thank you for your help, it worked and I was able to solve the problem using your instructions.
