Sub topic 12
Troubleshooting: pointer files in the working tree and missing objects
This chapter assumes you can clone, commit, push, and pull with Git. It also assumes you have used git lfs track, you know what a pointer file is, and you know what .gitattributes does. Most Git LFS problems fall into two groups. In the first, a file in your working tree is still a small pointer instead of the real content. In the second, Git LFS cannot find an object it needs, either locally or on the server.
Telling the two problems apart
A pointer file in the working tree means Git has the pointer, but the real content never reached your disk or was never swapped in. A missing object means the pointer exists in a commit, but the LFS server has no content for its SHA-256 oid.
The first problem usually has a local cause and is fixed on your machine. The second usually has a cause on the pusher's side and is fixed by someone who still has the content.
| Symptom | Likely group | First command to run |
|---|---|---|
| A `.psd` opens as a tiny text file | Pointer in working tree | `git lfs ls-files` |
| Editor says "not a valid image" | Pointer in working tree | `head -c 200 path/to/file` |
| `Smudge error: ... object not found` | Missing object | `git lfs fetch --all` |
| `Encountered 1 file that should have been a pointer, but wasn't` | Wrong commit state | `git lfs status` |
| 401 or 403 during `git lfs pull` | Credentials or permissions | `git lfs env` |
Recognizing a pointer file
Look at the first bytes of the file. A pointer is plain text and always begins with the same line.
head -c 200 design/logo.psdIf you see the following, the file is a pointer:
version https://git-lfs.github.com/spec/v1
oid sha256:4d7a214614ab2935c943f9e0ff69d22eadbb8f32b1258daaa5e2ca24d17e2393
size 12345Then ask LFS what it knows:
git lfs ls-filesEach line shows a short oid, a marker, and a path. An asterisk (*) after the oid means the real content is in your working tree. A minus sign (-) means only the pointer is there. A - on a file you expected to be real confirms the diagnosis.
git lfs ls-files lists only files that Git has recorded as pointers in the index. A file missing from this list, but matching a tracked pattern, was committed as a normal blob. That is a separate problem, covered below.
Cause 1: the LFS filters were never installed
The smudge filter is what downloads content and writes it into the working tree during checkout. It is registered in your Git configuration by git lfs install. If you skipped that step on this machine, or in this user account, Git checks out the pointers as ordinary text and says nothing.
Check the configuration:
git config --get-regexp "filter.lfs"You should see filter.lfs.clean, filter.lfs.smudge, filter.lfs.process, and filter.lfs.required. If the output is empty, run:
git lfs install
git lfs pullgit lfs pull fetches missing objects and then replaces pointers with the real files. It is the fetch step plus the checkout step in one command. You can run them separately when you want to see which one fails:
git lfs fetch
git lfs checkoutgit lfs fetch only downloads objects into .git/lfs/objects. git lfs checkout only copies objects that are already in that store into the working tree. If fetch succeeds and checkout fails, the problem is local. If fetch fails, the problem is the server or your access to it.
Cause 2: smudge was skipped on purpose
Pointers are the expected result when the smudge step is skipped. This happens in a few places:
- A clone made with
GIT_LFS_SKIP_SMUDGE=1, as in the partial-download workflow from the cloning chapter. - A CI job that checks out the repository without LFS enabled.
- A Git client or IDE that bypasses the hooks and filters.
- A configuration with
lfs.fetchexcludeor anlfs.fetchincludethat does not cover the path.
Look for exclusions in the effective configuration:
git config --show-origin --get-regexp "lfs\.fetch"
echo "${GIT_LFS_SKIP_SMUDGE:-unset}"To download one directory and nothing else:
git lfs pull --include="textures/"To download everything, run git lfs pull with no filters. Remove any lfs.fetchexclude setting if it is hiding the files you need.
In GitHub Actions, the checkout action leaves pointers unless you ask for LFS content:
steps:
- uses: actions/checkout@v4
with:
lfs: trueCause 3: the file was committed before it was tracked
You ran git add on a large file before git lfs track wrote the pattern to .gitattributes. Git stored the real bytes as a normal blob. Tracking the pattern later does not change that commit. Git LFS now sees a tracked path whose content is not a pointer, and it may print a warning such as:
Encountered 1 file(s) that should have been pointers, but weren't:
design/logo.psdCheck what Git thinks is staged:
git lfs statusFor a file that is only in your working tree and index, and not yet pushed, you can re-run the clean filter on it:
git add --renormalize .
git commit -m "Convert logo.psd to an LFS pointer"--renormalize re-applies attribute-driven filters to files Git already tracks. Make sure .gitattributes itself is committed first, or the filter has nothing to apply.
If the large blob is already in pushed history, renormalizing only fixes new commits. The old blob stays in the repository and keeps its size cost. Use git lfs migrate import to rewrite history, as described in the migration chapter, and coordinate the force push with your team.
A related trap is a .gitattributes file that is in the wrong place or not committed. The patterns in it apply to the directory it lives in and below. If a teammate's clone has no .gitattributes for a path, their Git will not run the LFS filter for it, even though the repository holds a pointer there.
Cause 4: the object is missing on the server
This is the harder case. Your pointer is correct, but the download fails with a message like this:
Downloading design/logo.psd (12 KB)
Error downloading object: design/logo.psd (4d7a214): Smudge error: Error downloading design/logo.psd (4d7a214614ab2935c943f9e0ff69d22eadbb8f32b1258daaa5e2ca24d17e2393): [404] Object does not exist on the serverThe usual reasons are:
- The author committed the pointer, but the LFS upload never completed. The pre-push hook is installed by
git lfs install. It is skipped when someone pushes withgit push --no-verifyor from a client that does not run hooks. - The author pushed to a different remote than the one you are using, for example their fork.
- A server administrator deleted the object, or a repository was mirrored without its LFS store.
- A force push or branch rewrite changed the
oidof a file, and the new content was never uploaded.
To confirm, run a consistency check in the clone that should have the content:
git lfs fsckgit lfs fsck verifies that LFS objects referenced by the current commit exist and match their recorded hashes. It reports missing or corrupt objects. Add --pointers to check pointer files only, without reading object contents.
The fix has to be done by someone who still holds the content. On that machine, make sure the object is in the local store, then push everything:
git lfs fetch --all origin
git lfs push --all origingit lfs push --all uploads every LFS object reachable from the refs, not only the ones in the latest commit. This is the safe choice when you are not sure which versions are missing. If no one has the file, the pointer is permanently dangling. The only recovery is to restore the file from a backup and commit it again.
When a repository is moved between hosts, copy the LFS objects explicitly. A plain git push --mirror sends Git objects but not LFS content.
Cause 5: authentication, quotas, and endpoints
Not every failure to download means the object is missing. Print the endpoint and credentials helper that LFS is using:
git lfs envCheck the Endpoint= line. It should point at the host you expect. If it does not, check the lfsurl setting in .lfsconfig and your remote URL.
Also look at the status code in the error message:
- 401 or 403: Your credentials are wrong, expired, or do not have read access. Re-authenticate through your credential helper. SSH remotes need the
git-lfs-authenticatecall to succeed, so test plain SSH access first. - 404: Either the object is missing, or the repository path is wrong.
- 429, or a message about bandwidth or storage: You reached a quota on the hosting service. Quotas were covered in the server chapter. Waiting for the next billing period, buying more data, or deleting unneeded objects are the usual options.
For a deeper look, turn on tracing for one command:
GIT_TRACE=1 GIT_CURL_VERBOSE=1 git lfs pull 2>&1 | head -n 80The trace shows the exact URLs requested and the HTTP responses. It can include authorization headers, so remove tokens before pasting the output into a ticket or chat.
Cleaning up after local damage
If a local object is corrupt, for example after a disk error or interrupted download, remove it and fetch again. Objects live under .git/lfs/objects, organized by the first four hex digits of the oid.
git lfs fsck
rm .git/lfs/objects/4d/7a/4d7a214614ab2935c943f9e0ff69d22eadbb8f32b1258daaa5e2ca24d17e2393
git lfs fetch
git lfs checkoutAlso be aware of git lfs prune. It deletes local objects that are not needed by recent commits. It does not touch the server, so a pruned file you later need can be downloaded again. It is safe only if the server really holds the content. Check with git lfs fsck or a fresh git lfs fetch before pruning in a clone that might hold the only copy.
A checklist for any report
When you ask a teammate or a support desk for help, include the output of these commands:
git lfs version
git lfs env
git lfs ls-files
git lfs status
git lfs fsckThis tells them the client version, the endpoint, which files are pointers, and whether any objects are missing.
Exercise
A teammate clones the repository and finds that every .png under assets/ is a 130-byte text file. git config --get-regexp filter.lfs prints nothing. Which two commands fix this, in what order, and why does that order matter?
Show answer
Run git lfs install first, then git lfs pull. The install step registers the LFS clean and smudge filters in the user's Git configuration. Without them, git lfs pull can download the objects, but you want the filters in place so later checkouts and commits handle LFS files correctly. git lfs pull then fetches the missing objects and replaces the pointers in the working tree with the real files.
Exercise
git lfs pull fails with "[404] Object does not exist on the server" for one file. git lfs fsck in the original author's clone shows the file is present locally. What should the author run, and why --all?
Show answer
The author should run git lfs push --all origin. The pointer reached the server through Git, but the content upload never finished, for example because the push skipped the pre-push hook. --all uploads every LFS object reachable from all refs, so it also repairs older versions that other branches or tags might still need.