Using tokens: THE BASICS PLEASE?

I have no problem logging into Hugging Face and to GitHub using conventional User/Password entry. I get access to gated public collections and can download individual files (e.g. Flux1-dev + needed extras).

How exactly does one login using a token? I know how to create tokens but not the means for entering them. This arises when a token is demanded to clone a repository. The standard username/password format is presented. Upon failure, a message states that this means of verification is obsolete and points to information which so far as I can tell does not spell out exactly what one should do.

1 Like

FLUX.1 is a gated model, so you need to get approval, and if you’re on Windows, you have to download Git and GitLFS and upgrade them beforehand, etc. But let’s set that aside for now…
I think doing it like this is better for Git.

python -m pip install huggingface_hub
hf auth login --add-to-git-credential   # paste your HF token

This is a super common stumbling block — you’re right that Hugging Face and GitHub both deprecated plain username/password logins for git clone and now require tokens. The trick is: you use the token as your password.

Here’s the step-by-step:


:key: Hugging Face (git clone with token)

  1. Create a token

    • Go to Hugging Face tokens page.

    • Generate a read token (or write if you need push access).

  2. Clone using HTTPS
    Instead of your password, paste the token:

    git clone https://huggingface.co/username/repo-name
    
    

    When prompted for:

    • Username → enter your HF username or __token__

    • Password → paste your access token

    Example:

    Username: __token__
    Password: hf_xxxxxxxxxxxxxxxxxxxxx
    
    
  3. Or set up credential helper

    git config --global credential.helper store
    
    

    Then after you enter the token once, it’s remembered.


:key: GitHub (same pattern)

  1. Generate a Personal Access Token (PAT) at GitHub → Settings → Developer settings → Tokens.

  2. Use HTTPS clone:

    git clone https://github.com/username/repo-name.git
    
    

    Then:

    • Username = your GitHub username

    • Password = the token