cd /news/ai-tools/how-to-login-to-huggingface-hub-with… · home › topics › ai-tools › article
[ARTICLE · art-179978] src=discuss.huggingface.co ↗ pub= topic=ai-tools verified=true sentiment=· neutral

How to login to Huggingface Hub with Access Token

Hugging Face users can log in to the Hugging Face Hub from the command line by running `hf auth login` and selecting "Paste an access token," then pressing Enter and confirming the account with `hf auth whoami`. If the wrong account appears, the saved token may be overridden by the `HF_TOKEN` environment variable, which takes precedence, or by a stale Hugging Face entry in `~/.netrc`; deleting `~/.netrc` and logging in again resolved the issue for one user. The guidance matters because `~/.netrc` can also hold credentials for other services, so users should check for an old Hugging Face entry before removing the file.

recommendation

When CLI login shows the wrong Hugging Face account, check the `HF_TOKEN` environment variable first because it overrides the saved token, then inspect `~/.netrc` for an old entry before deleting it.

more in playbook: Running AI in production
read1 min views9 publishedDec 2, 2026
How to login to Huggingface Hub with Access Token
Image: Discuss (auto-discovered)

This worked for me, thank you so much for coming here to to tell us.

I had this same issue. I was using

hf auth login –add-to-git-credential –token it wasn’t the paste issue for me, but rather that I still had a

~/.netrc

rm ~/.netrc then tried to login again and it worked

Run hf auth login and choose “Paste an access token.” If nothing shows up when you paste, that’s normal. Press Enter, then run hf auth whoami to check which account you’re logged in as.

If it shows the wrong account, check whether HF_TOKEN is set. It takes precedence over the saved token. If you suspect ~/.netrc, check for an old Hugging Face entry first. The file may also contain credentials for other services.

── more in #ai-tools 4 stories · sorted by recency
── more on @hugging face 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/how-to-login-to-hugg…] indexed:0 read:1min 2026-12-02 · —