# Git lfs fetch with git protocol is failing

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fgit-lfs-fetch-with-git-protocol-is-failing%2F84831%3E%5C
**Category:** 🤗Hub\
**Created:** [May 2, 2024, 12:27pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fgit-lfs-fetch-with-git-protocol-is-failing%2F84831 "2024-05-02T12:27:23Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![catwell](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/catwell/32/26500_2.png) [@catwell](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fcatwell)%5C
**Post date:** [May 2, 2024, 12:27pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fgit-lfs-fetch-with-git-protocol-is-failing%2F84831%2F1 "2024-05-02T12:27:23Z")

</div>

I can no longer fetch files (or clone) using LFS and the Git protocol. I have tested from multiple machines, on multiple repositories and asked colleagues to test, they are seeing the same issue. It used to work until recently.

This is the error I am getting (fetch output is cleaner but you can also `git clone git@hf.co:runwayml/stable-diffusion-v1-5`):

```auto
$ git lfs fetch --all
fetch: 40 objects found, done.                                                  
fetch: Fetching all references...
batch request: unexpected end of JSON input0 B/s                                
error: failed to fetch some objects from 'https://hf.co/runwayml/stable-diffusion-v1-5.git/info/lfs'

```

Using `GIT_TRACE=1` the error comes from here:

```auto
14:25:54.392991 trace git-lfs: tq: sending batch of size 40
14:25:54.393331 trace git-lfs: run_command: ssh git@hf.co git-lfs-authenticate runwayml/stable-diffusion-v1-5 download
14:25:54.393494 trace git-lfs: exec: ssh 'git@hf.co' 'git-lfs-authenticate runwayml/stable-diffusion-v1-5 download'
14:25:55.631165 trace git-lfs: ssh: git@hf.co failed, error: unexpected end of JSON input, message: (try: 0/6)

```

Can anyone reproduce this and do you have an idea where it comes from?

---

<div class="post-metadata">

**Author:** ![jac-jim](https://avatars.discourse-cdn.com/v4/letter/j/8797f3/32.png) [@jac-jim](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fjac-jim)%5C
**Post date:** [May 3, 2024, 6:58pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fgit-lfs-fetch-with-git-protocol-is-failing%2F84831%2F2 "2024-05-03T18:58:24Z")

</div>

I too am experiencing issues, perhaps the network is saturated.

```auto
Downloading model-00001-of-00004.safetensors (3.9 GB)
Error downloading object: model-00001-of-00004.safetensors (6b2ad54): Smudge error: Error downloading model-00001-of-00004.safetensors (6b2ad54dc70d94849c10d97b6d2faa80e9c94b21d3b7f67343ffa7b79809d88f): batch request: unexpected end of JSON input

```

---

<div class="post-metadata">

**Author:** ![edornd](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/edornd/32/26590_2.png) [@edornd](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fedornd)%5C
**Post date:** [May 4, 2024, 2:09pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fgit-lfs-fetch-with-git-protocol-is-failing%2F84831%2F3 "2024-05-04T14:09:10Z")

</div>

Just adding myself to the list here: I am instead trying to push on private repositories, but I’m getting the same error “unexpected end of JSON input” from multiple repositories, accounts, and machines. This is only related to LFS, while normal files like README.md can be pushed without any issue.

If somebody has a solution or any updates on the matter, I’d be happy to try/know!

---

<div class="post-metadata">

**Author:** ![manykwh](https://avatars.discourse-cdn.com/v4/letter/m/7ba0ec/32.png) [@manykwh](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fmanykwh)%5C
**Post date:** [May 4, 2024, 3:42pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fgit-lfs-fetch-with-git-protocol-is-failing%2F84831%2F4 "2024-05-04T15:42:02Z")

</div>

I’d tempted to think we used up our free bandwidth, but reading the perks of upgrading accounts says nothing about increased download caps? I’m happy to upgrade.

---

<div class="post-metadata">

**Author:** ![manykwh](https://avatars.discourse-cdn.com/v4/letter/m/7ba0ec/32.png) [@manykwh](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fmanykwh)%5C
**Post date:** [May 4, 2024, 3:52pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fgit-lfs-fetch-with-git-protocol-is-failing%2F84831%2F5 "2024-05-04T15:52:08Z")

</div>

Update: unless the problem was coincidentally fixed in this moment, then, using git clone with https instead of ssh had just worked for me.

`git clone https://huggingface.co/.....`

Usually I use SSH and clone like this

`git clone git@hf.co:.....`

but the SSH method is providing that “end of JSON” exception, similar to what y’all are experiencing. Try https instead!

---

<div class="post-metadata">

**Author:** ![jac-jim](https://avatars.discourse-cdn.com/v4/letter/j/8797f3/32.png) [@jac-jim](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fjac-jim)%5C
**Post date:** [May 4, 2024, 4:04pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fgit-lfs-fetch-with-git-protocol-is-failing%2F84831%2F6 "2024-05-04T16:04:42Z")

</div>

SSH is certainly having issues.

---

<div class="post-metadata">

**Author:** ![dpaleka](https://avatars.discourse-cdn.com/v4/letter/d/ebca7d/32.png) [@dpaleka](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fdpaleka)%5C
**Post date:** [May 4, 2024, 10:14pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fgit-lfs-fetch-with-git-protocol-is-failing%2F84831%2F7 "2024-05-04T22:14:42Z")

</div>

For everyone failing to do `git push`, the following workaround did it for me:

1. Switch your remote to `https`, e.g.

```plaintext
git remote set-url origin https://hf.co/.../reponame.git

```

1. Kill your git credentials by clearing `~/.git-credentials` and doing

```plaintext
git credential-cache exit

```

1. Regenerate a [User Access Token](https://huggingface.co/settings/tokens) with correct permissions
2. `git push` and enter everything when prompted.

---

<div class="post-metadata">

**Author:** ![edornd](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/edornd/32/26590_2.png) [@edornd](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fedornd)%5C
**Post date:** [May 5, 2024, 8:46am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fgit-lfs-fetch-with-git-protocol-is-failing%2F84831%2F8 "2024-05-05T08:46:37Z")

</div>

Thanks @dpaleka, works like a charm! It would be great to get back to SSH keys soon, but for the time being this works.

---

<div class="post-metadata">

**Author:** ![NickKolok](https://avatars.discourse-cdn.com/v4/letter/n/f19dbf/32.png) [@NickKolok](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FNickKolok)%5C
**Post date:** [May 5, 2024, 6:17pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fgit-lfs-fetch-with-git-protocol-is-failing%2F84831%2F9 "2024-05-05T18:17:55Z")

</div>

The same error for me, [Cannot do git pull from a repo at HF: lfs fails](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fcannot-do-git-pull-from-a-repo-at-hf-lfs-fails%2F85281)

---

<div class="post-metadata">

**Author:** ![NickKolok](https://avatars.discourse-cdn.com/v4/letter/n/f19dbf/32.png) [@NickKolok](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FNickKolok)%5C
**Post date:** [May 5, 2024, 6:53pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fgit-lfs-fetch-with-git-protocol-is-failing%2F84831%2F10 "2024-05-05T18:53:25Z")

</div>

As for me, a proper temporary workaround is

```auto
git config --add lfs.url "https://huggingface.co/NickKolok/repo_name.git/info/lfs"

```

Taken here: [Files get skipped, repository or object not found. · Issue #1151 · git-lfs/git-lfs · GitHub](https://github.com/git-lfs/git-lfs/issues/1151#issuecomment-212589081)

Still looks like git-lfs is a scam.

---

<div class="post-metadata">

**Author:** ![aclegg3](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/aclegg3/32/26688_2.png) [@aclegg3](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Faclegg3)%5C
**Post date:** [May 6, 2024, 8:36pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fgit-lfs-fetch-with-git-protocol-is-failing%2F84831%2F11 "2024-05-06T20:36:52Z")

</div>

Same issue here.

`git checkout` and `git merge` of a remote branch to local through SSH is failing with:

```auto
Downloading <object> (13 KB)
Error downloading object: <object> (): Smudge error: Error downloading <object> (<object>): batch request: unexpected end of JSON input

Errors logged to ----
Use `git lfs logs last` to view the log.
error: external filter 'git-lfs filter-process' failed
fatal: <object>: smudge filter lfs failed

```

Switching to `https` does resolve the issue for now. This is not a solution, SSH needs to work.

---

<div class="post-metadata">

**Author:** ![catwell](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/catwell/32/26500_2.png) [@catwell](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fcatwell)%5C
**Post date:** [June 4, 2024, 3:41pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fgit-lfs-fetch-with-git-protocol-is-failing%2F84831%2F12 "2024-06-04T15:41:02Z")

</div>

I think it works now, HF must have fixed it at some point.
