# Fix Git LFS Object Download Failed for Large Files
You clone a repository that uses Git LFS (Large File Storage), but when you checkout the files, you get placeholder text instead of the actual file content:
version https://git-lfs.github.com/spec/v1
oid sha256:abc123...
size 52428800Or during a pull:
batch request: missing: 3 objects
Error downloading object: models/model-v2.bin (abc1234): Smudge errorGit LFS replaces large files with pointer files in the repository. The actual file content is stored on a separate LFS server and downloaded on demand.
Step 1: Install Git LFS
If Git LFS is not installed, pointer files are never resolved:
git lfs versionIf not installed:
```bash # Debian/Ubuntu sudo apt install git-lfs
# macOS brew install git-lfs
# Install the Git LFS hooks git lfs install ```
The git lfs install command sets up the smudge and clean filters that automatically download LFS objects when checking out files.
Step 2: Fetch LFS Objects
If Git LFS is installed but files are still pointers:
git lfs fetch --all
git lfs checkoutThe fetch --all downloads all LFS objects from the remote. The checkout replaces pointer files with actual content.
Step 3: Check LFS Server Connectivity
LFS objects are downloaded from a separate server. Verify connectivity:
git lfs envThis shows the LFS endpoint:
LocalWorkingDir=/path/to/repo
LocalGitDir=/path/to/repo/.git
Endpoint=https://github.com/user/repo.git/info/lfs (auth=none)
LocalStorageDir=/path/to/repo/.git/lfs/objectsTest the endpoint:
curl -I https://github.com/user/repo.git/info/lfsIf the endpoint requires authentication:
```bash # For GitHub git config --global lfs.https://github.com.access basic
# For GitLab git config --global lfs.https://gitlab.com.access basic ```
Step 4: Retry Failed Downloads
If some objects failed to download:
```bash # Show which objects are missing git lfs status
# Retry downloading git lfs fetch origin git lfs checkout ```
For specific files:
git lfs pull --include="models/*.bin,videos/*.mp4"Step 5: Large File Transfer Issues
For very large LFS objects (several GB), the download may timeout:
```bash # Increase timeout GIT_CURL_VERBOSE=1 git lfs fetch --all
# Configure larger buffer git config --global http.postBuffer 524288000 git config --global lfs.concurrenttransfers 3 ```
Reducing concurrenttransfers from the default (8) to 3 uses less bandwidth per transfer, which can help on unstable connections.
Step 6: LFS Object Not Found on Server
If the LFS server reports an object is missing:
batch response: Object not found: abc1234This means the LFS object was never pushed to the server, or was garbage collected. Check:
```bash # Verify LFS objects locally git lfs ls-files
# Check if the object exists in the local store git lfs fsck ```
If fsck reports missing objects, the data is lost from the LFS server. Recovery options:
- 1.Ask a team member who has the file to push the LFS object:
- 2.```bash
- 3.# On their machine:
- 4.git lfs push --all origin
- 5.
` - 6.If you have a backup of the original file, re-add it:
- 7.```bash
- 8.git lfs track "*.bin"
- 9.git add models/model-v2.bin
- 10.git commit -m "Re-add LFS object"
- 11.git push
- 12.
`
Step 7: Clone With LFS in One Step
To avoid the pointer file issue entirely, always clone with LFS:
GIT_LFS_SKIP_SMUDGE=0 git clone https://github.com/user/repo.git
cd repo
git lfs pullOr use the standard clone (LFS fetches automatically):
git clone https://github.com/user/repo.git
cd repo
# LFS files are automatically downloaded if git-lfs is installedStep 8: Shallow Clone With LFS
Shallow clones (--depth 1) can miss LFS objects from older commits:
git clone --depth 1 https://github.com/user/repo.git
cd repo
git lfs fetch --all # May fail for objects not in HEADFor full LFS support, avoid shallow clones or ensure all needed LFS objects are in the latest commit.