User mrlordbrown couldn't log into Hugging Face Hub via the CLI: every time he pasted a token — read or write — he got an "Invalid token passed!" error. The thread racked up 42 replies, 79 likes, and 175,225 views, so plenty of people are clearly hitting this. The discussion isn't about the token itself but about local causes: stale credentials and environment variables that can override a fresh login.
Thread author mrlordbrown walked through everything he'd tried: registered, accepted the model terms, created a conda environment, installed huggingface-cli, and ran huggingface-cli login. The token was rejected whether he pasted it or typed it manually. He deleted and recreated tokens, set up git lfs, and rebooted his machine. The traceback shows the call going through huggingface_cli.py and the _validate_or_retrieve_token function.
KimMarie wrote a short note saying everything worked for him and thanked the thread for the clarification. He didn't say what exactly he did, so this comment is only useful as proof of success — not as an explanation.
strawmanned reported a similar problem, but not with pasting the token. In his case, a leftover ~/.netrc file was getting in the way. He ran rm ~/.netrc, logged in again with --add-to-git-credential, and said everything worked after that. That's the only concrete diagnostic step in the visible part of the thread.
ryanwilliams1, the last person to reply, gave the most structured advice. According to him, an empty input field after pasting a token is "normal". Hit Enter, then check hf auth whoami to see which account you're actually logged in as. If it's the wrong account, check the HF_TOKEN variable, which — he says — takes priority over the stored token. He also suggests looking for an old Hugging Face entry in ~/.netrc, warning that credentials for other services may live there too.
Everyone agrees on one thing: the problem probably isn't the token itself, but the CLI pulling credentials from the wrong source. Both strawmanned and ryanwilliams1 point to ~/.netrc as a possible source of conflict, and both advise checking which account or token is actually active.
They disagree on the root cause. strawmanned blames the old ~/.netrc file, while ryanwilliams1 says to check HF_TOKEN first and only then the file. There's another split over the input field: ryanwilliams1 calls the empty field normal, while the thread author described a paste that simply didn't work. From the visible replies, it's unclear whether any of this actually fixed things for the author — the thread has 42 replies, but only three comments were included here. His final resolution isn't visible.
1. Run hf auth whoami (or huggingface-cli whoami if you're on an older version of the package). If the output shows the wrong account, dig into where the token is coming from.
2. Check the HF_TOKEN environment variable in your current terminal session. It can override your saved login even if you just logged in again.
3. Open ~/.netrc and look for an old entry for huggingface.co. On Windows the file may be called _netrc in your home folder, so check both. Back it up before deleting anything — it may contain entries for other services.
4. Pay attention to your CLI version. The author's traceback mentions huggingface-cli, while ryanwilliams1's comment references hf auth login. This likely comes down to different versions of the huggingface_hub package, so match the command to your installed version.
5. After any change, log in again and run whoami once more. That way you'll know the fix actually worked rather than coinciding with something else, like a reboot.
Hugging Face Forum — How to login to Huggingface Hub with Access Token
Disclaimer: this is a summary of a discussion, not editor-verified facts. Opinions belong to the participants; the numbers belong to whoever cited them.
Source: discuss.huggingface.co · post in Telegram