Git lfs fetch with git protocol is failing

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):

$ 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:

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?

7 Likes

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

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

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!

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.

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!

2 Likes

SSH is certainly having issues.

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

  1. Switch your remote to https, e.g.
git remote set-url origin https://hf.co/.../reponame.git
  1. Kill your git credentials by clearing ~/.git-credentials and doing
git credential-cache exit
  1. Regenerate a User Access Token with correct permissions
  2. git push and enter everything when prompted.
3 Likes

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

1 Like

The same error for me, Cannot do git pull from a repo at HF: lfs fails

As for me, a proper temporary workaround is

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

Still looks like git-lfs is a scam.

1 Like

Same issue here.

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

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.