# 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:** 1\
**Showing post:** 3

<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.

---

_[View the full topic](https://discuss.huggingface.co/t/error-login-hf-create-token-error/176889)._
