Unable to clone repository via ssh

I followed Git over SSH to test my SSH authentication

(base) ➜  ssh -T git@hf.co
Hi ivnle, welcome to Hugging Face.

ivnle is the correct account that I added my public key to, but I’m unable to clone this repository.

(base) ➜  git clone hf.co:datasets/bigcode/starcoderdata data/starcoderdata-raw
Cloning into 'data/starcoderdata-raw'...
ivanlee@hf.co: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

I’ve obserbed the same issue across multiple machines and repositories

(ctt) (base) ➜  git clone hf.co:datasets/karpathy/tiny_shakespeare
Cloning into 'tiny_shakespeare'...
ivanlee@hf.co: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

I can use https to clone

(ctt) (base) ➜  git clone https://huggingface.co/datasets/karpathy/tiny_shakespeare
Cloning into 'tiny_shakespeare'...
remote: Enumerating objects: 36, done.
remote: Counting objects: 100% (2/2), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 36 (delta 0), reused 0 (delta 0), pack-reused 34
Unpacking objects: 100% (36/36), 8.49 KiB | 115.00 KiB/s, done.

but not all repositories allow for https clone e.g. starcoderdata

2 Likes

Same for me. I have setup the ssh and previously it works. About 3 months later, when I created a new space, I could no longer use the git ssh for all commands. When I tried to create a new SSH key, it told me the same SSH key had already been added.

Same, no way to fetch via git/ssh on repo ref, but download still works

Could you please check if it’s back to normal? thanks

wow working now :tada:

1 Like

Facing the same issue. Unable to clone a repo with ssh.

Im also unable to clone via ssh / git

More specifically, i get permission denied on cloning any model from hugging face

Same for me

What worked on my case was modifying ~/.ssh/config like this

# Huggingface
Host hf.co
    HostName hf.co
    User git
    IdentityFile ~/.ssh/id_ed25519_huggingface # Or the name you want

then I cloned again my repository using

git clone hf.co:datasets/<USER>/<NAME>

Notice the hostname is different than the instruction in the UI (it says git clone https://huggingface.co/datasets/<USER>/<NAME>). Not sure if this is the reason it don’t works, but it worked in my case.

1 Like