Fix git "smudge filter lfs failed" and pointer files where model weights should be
The problem
Cloning a repo with large model files failed at checkout:
Filtering content: 0% (0/12)
error: external filter 'git-lfs filter-process' failed
fatal: the remote end hung up unexpectedly
And worse: a teammate had pushed BEFORE installing LFS, so the repo now contained 134-byte pointer files — version https://git-lfs.github.com/spec/v1 — where the .safetensors should be.
What didn't work
- Running
git lfs installafter the fact — fixes future pushes, does nothing about the pointers already committed to history. git checkout -- .— the smudge filter still fails because the actual objects were never uploaded to the LFS store.- Delete and re-clone — identical error; LFS is still unconfigured on the machine.
The fix
git lfs install # registers the clean/smudge filters for this user
git lfs fetch --all origin # pull every object the pointers reference
git lfs checkout # swap working-tree pointers back to real files
# verify nothing is still a pointer:
grep -rl "git-lfs.github.com/spec" . --exclude-dir=.git || echo "working tree clean"
# pushing correctly from now on — track BEFORE add, always:
git lfs track "*.safetensors" # writes the pattern into .gitattributes
git add .gitattributes model.safetensors
git commit -m "add model weights via LFS"
git push origin main
Why it works
Pointer files mean the blob lives in the LFS object store, not git's object database; fetch --all + checkout reconciles the working tree with that store, and lfs track before git add is the only ordering that routes the blob to LFS instead of committing 134 bytes of pointer text forever.