Authentication error while cloning a private space

I’m trying to clone a private space on another computer (I already cloned it one time) but it gives me an authentication error, I’ve checked the password several times and it’s the right one, what could it be due to?

I can clone other public spaces that do not require the password:

a457934@ESSEV10L1686140 git % git clone https://huggingface.co/spaces/mnslarcher/minimal/tree/main
Cloning into 'main'...
Username for 'https://huggingface.co': mnslarcher
Password for 'https://mnslarcher@huggingface.co': 
fatal: Authentication failed for 'https://huggingface.co/spaces/mnslarcher/minimal/tree/main/'

I can clone other public spaces that do not require the password:

a457934@ESSEV10L1686140 git % git clone https://huggingface.co/spaces/Alican/pixera
Cloning into 'pixera'...
remote: Enumerating objects: 171, done.
remote: Counting objects: 100% (6/6), done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 171 (delta 2), reused 0 (delta 0), pack-reused 165
Receiving objects: 100% (171/171), 4.57 MiB | 1.40 MiB/s, done.
Resolving deltas: 100% (63/63), done.
a457934@ESSEV10L1686140 git %

I tried now doing exactly the same operation and it works, probably it was a temporary HF space problem (?)

1 Like

hi @mnslarcher,

Two points: first, you’re trying to clone a repo address with some extra params /tree/main. That won’t work. The correct would be git clone https://huggingface.co/spaces/mnslarcher/minimal

Second: It seems like your Space is private, so you need to be logged in with your personal tokens.
Or a shortcut with a shortcut git clone https://USER:TOKEN@huggingface.co/spaces/mnslarcher

2 Likes

Hi @radames, thanks!

Probably when I repeated the procedure later and it worked I convinced myself I was doing the same but was instead just using “Minimal - a Hugging Face Space by mnslarcher” correctly.

Changing the address I entered user and password when asked and it worked, but thanks for pointing me to an alternate way of doing it!

1 Like
! git clone https://{username}:{token}@huggingface.co/mistralai/Mistral-7B-v0.1
Cloning into 'Mistral-7B-v0.1'...
remote: Authorization error.
fatal: unable to access 'https://huggingface.co/mistralai/Mistral-7B-v0.1/': The requested URL returned error: 403

I don’t understand what should I do.

I have even access for this repo in hub on mistral repo.

1 Like

The 401 Unauthorized error indicates that the URL requires authentication. You need to provide your Hugging Face credentials (API token) to access the file. You can use wget with an authorization header to include your Hugging Face API token. Here’s how to do it:

  1. Obtain your Hugging Face API token from your account settings on the Hugging Face website.
  2. Use the wget command with the --header option to include your token:

wget --header=“Authorization: Bearer YOUR_HUGGING_FACE_API_TOKEN” https://huggingface.co/stabilityai/stable-diffusion-3-medium/resolve/main/sd3_medium_incl_clips_t5xxlfp8.safetensors
Replace YOUR_HUGGING_FACE_API_TOKEN with your actual Hugging Face API token.
Make sure to keep your API token secure and do not expose it in public repositories or logs.