# Unable to clone repository via ssh

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Funable-to-clone-repository-via-ssh%2F79478%3E%5C
**Category:** 🤗Hub\
**Created:** [March 31, 2024, 3:01am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Funable-to-clone-repository-via-ssh%2F79478 "2024-03-31T03:01:13Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![ivnle](https://avatars.discourse-cdn.com/v4/letter/i/b5a626/32.png) [@ivnle](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fivnle)%5C
**Post date:** [March 31, 2024, 3:01am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Funable-to-clone-repository-via-ssh%2F79478%2F1 "2024-03-31T03:01:13Z")

</div>

I followed [Git over SSH](https://huggingface.co/docs/hub/security-git-ssh#generating-a-new-ssh-keypair) to test my SSH authentication

```auto
(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.

```auto
(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

```auto
(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

```auto
(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`

---

<div class="post-metadata">

**Author:** ![shengxio](https://avatars.discourse-cdn.com/v4/letter/s/b2d939/32.png) [@shengxio](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fshengxio)%5C
**Post date:** [May 26, 2024, 5:11pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Funable-to-clone-repository-via-ssh%2F79478%2F2 "2024-05-26T17:11:51Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![changliu8541](https://avatars.discourse-cdn.com/v4/letter/c/85e7bf/32.png) [@changliu8541](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fchangliu8541)%5C
**Post date:** [May 26, 2024, 7:17pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Funable-to-clone-repository-via-ssh%2F79478%2F3 "2024-05-26T19:17:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![radames](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/radames/32/28246_2.png) [@radames](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fradames)%5C
**Post date:** [May 28, 2024, 2:57am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Funable-to-clone-repository-via-ssh%2F79478%2F4 "2024-05-28T02:57:56Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![changliu8541](https://avatars.discourse-cdn.com/v4/letter/c/85e7bf/32.png) [@changliu8541](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fchangliu8541)%5C
**Post date:** [May 28, 2024, 5:01am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Funable-to-clone-repository-via-ssh%2F79478%2F5 "2024-05-28T05:01:23Z")

</div>

wow working now 🎉

---

<div class="post-metadata">

**Author:** ![nmadaan](https://avatars.discourse-cdn.com/v4/letter/n/c5a1d2/32.png) [@nmadaan](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fnmadaan)%5C
**Post date:** [June 23, 2024, 11:47pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Funable-to-clone-repository-via-ssh%2F79478%2F6 "2024-06-23T23:47:18Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![AnonUsername986532](https://avatars.discourse-cdn.com/v4/letter/a/a8b319/32.png) [@AnonUsername986532](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FAnonUsername986532)%5C
**Post date:** [August 6, 2024, 12:58pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Funable-to-clone-repository-via-ssh%2F79478%2F8 "2024-08-06T12:58:58Z")

</div>

Im also unable to clone via ssh / git

---

<div class="post-metadata">

**Author:** ![AnonUsername986532](https://avatars.discourse-cdn.com/v4/letter/a/a8b319/32.png) [@AnonUsername986532](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FAnonUsername986532)%5C
**Post date:** [August 6, 2024, 1:51pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Funable-to-clone-repository-via-ssh%2F79478%2F9 "2024-08-06T13:51:38Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![gaoxuezhao](https://avatars.discourse-cdn.com/v4/letter/g/87869e/32.png) [@gaoxuezhao](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fgaoxuezhao)%5C
**Post date:** [August 8, 2024, 5:11am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Funable-to-clone-repository-via-ssh%2F79478%2F10 "2024-08-08T05:11:37Z")

</div>

Same for me

---

<div class="post-metadata">

**Author:** ![israellaguan](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/israellaguan/32/32186_2.png) [@israellaguan](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fisraellaguan)%5C
**Post date:** [September 28, 2024, 4:51pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Funable-to-clone-repository-via-ssh%2F79478%2F11 "2024-09-28T16:51:38Z")

</div>

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

```auto
# 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.
