{"slug": "how-to-login-to-huggingface-hub-with-access-token", "title": "How to login to Huggingface Hub with Access Token", "summary": "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.", "body_md": "This worked for me, thank you so much for coming here to to tell us.\n\n \n \nI had this same issue. I was using\n\nhf auth login –add-to-git-credential –token \n\nit wasn’t the paste issue for me, but rather that I still had a\n\n~/.netrc\n\nrm ~/.netrc then tried to login again and it worked\n\n \n \nRun `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.\n\nIf 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.", "url": "https://wpnews.pro/news/how-to-login-to-huggingface-hub-with-access-token", "canonical_source": "https://discuss.huggingface.co/t/how-to-login-to-huggingface-hub-with-access-token/22498?page=3#post_43", "published_at": "2026-12-02 05:30:45+00:00", "updated_at": "2026-12-02 05:45:24.463625+00:00", "lang": "en", "topics": ["ai-tools", "developer-tools"], "entities": ["Hugging Face", "Hugging Face Hub", "hf auth login", "hf auth whoami", "HF_TOKEN", "~/.netrc"], "also_reported_by": [], "takeaway": "Run `hf auth login`, paste the token (nothing displays on paste), verify with `hf auth whoami`, and if the wrong account shows, check `HF_TOKEN` first since it overrides the saved token, then look for a stale Hugging Face entry in `~/.netrc`.", "recommendation": {"advice": "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.", "playbook": "production-ops", "playbook_url": "https://wpnews.pro/playbooks/production-ops"}, "alternates": {"html": "https://wpnews.pro/news/how-to-login-to-huggingface-hub-with-access-token", "markdown": "https://wpnews.pro/news/how-to-login-to-huggingface-hub-with-access-token.md", "text": "https://wpnews.pro/news/how-to-login-to-huggingface-hub-with-access-token.txt", "jsonld": "https://wpnews.pro/news/how-to-login-to-huggingface-hub-with-access-token.jsonld"}}