Sub topic 12
Troubleshooting: Pointer Files in the Working Tree and Missing Objects
This chapter assumes you can clone, commit, and push with Git, and that you know how Git LFS tracks files through .gitattributes and stores pointer files in commits. Most LFS problems fall into two groups: you see a pointer file where you expected real content, or Git cannot find an object on the server.
Recognize a pointer file in the working tree
If the smudge filter did not run, the file on disk is the small text pointer, not the real binary. An image viewer or game engine then reports the file as corrupt. Check it directly:
head -c 200 design/logo.psd
git lfs ls-filesA pointer begins with version https://git-lfs.github.com/spec/v1 and is about 130 bytes. In git lfs ls-files output, a * after the object ID means the real content is present locally. A - means only the pointer is present.
Common causes of pointer files
| Cause | Why it happens | Fix |
|---|---|---|
| LFS not installed when you cloned | The smudge filter was not configured, so Git checked out pointers | Run `git lfs install`, then `git lfs pull` |
| `GIT_LFS_SKIP_SMUDGE=1` is set | Smudge is skipped on purpose | Unset it, then run `git lfs pull` |
| Partial pull | You used `--include` for one directory | Run `git lfs pull` with no filters |
| CI checkout | `actions/checkout` does not fetch LFS by default | Set `lfs: true` |
| File committed before it was tracked | The pattern was added to `.gitattributes` after the file was staged | Run `git add --renormalize .` and commit |
The usual repair is to download the objects and replace the pointers in your working tree:
git lfs install
git lfs pullgit lfs pull runs a fetch and then a checkout of the LFS files. Afterward git lfs ls-files should show * for every file you expect.
Diagnose missing objects
A different failure appears when Git does fetch the pointer but the server has no matching content. Typical messages are Smudge error: Error downloading ... object does not exist or [404] Object does not exist on the server.
The usual cause is a push that sent the commit but not the LFS objects. This happens when the author pushed with LFS hooks disabled or from a machine without LFS installed. It also happens when they pushed to a fork or mirror that does not hold the objects. Teammates cannot fix it, because only a clone that still has the objects can upload them.
flowchart TD
A["File looks wrong or checkout fails"] --> B{"Is the file a small text pointer?"}
B -- Yes --> C["Run git lfs pull"]
C --> D{"Does pull report missing objects?"}
D -- No --> E["Fixed"]
D -- Yes --> F["Ask the author to run git lfs push --all origin"]
B -- No --> G["Run git lfs status and check .gitattributes"]If the diagram renders as plain text in your viewer, the steps are these. First run git lfs pull. If it still reports missing objects, the author must push them.
The author runs the following on the machine that made the commit:
git lfs fsck
git lfs push --all origingit lfs fsck verifies that local objects exist and match their hashes. git lfs push --all origin uploads every LFS object reachable from your refs.
Gather diagnostic output
When the cause is unclear, collect more detail:
git lfs env
GIT_TRACE=1 GIT_CURL_VERBOSE=1 git lfs pullgit lfs env shows the endpoint URL, the storage path, and whether the filters are configured. The trace output shows the HTTP status of each request. A 401 or 403 means a credential problem, so check your credential helper or token scopes. A 404 points to missing objects or a wrong endpoint. A 429 or quota message points to bandwidth or storage limits on the server.
Fix files that were never converted
If a binary file is in history as a regular Git blob, LFS cannot help for new commits. Check git lfs status, then rewrite the file with git add --renormalize .. For existing history, use git lfs migrate import, as the migration chapter describes.
Exercise
After cloning a repository, design/logo.psd is 130 bytes and opens as text. git lfs ls-files lists it with a -. Which command should you run first, and what would it mean if it then reports [404] Object does not exist on the server?
Show answer
Run git lfs pull (after git lfs install if the filters were not set up). A 404 means the commit's author never uploaded the object. They must run git lfs push --all origin from a clone that still has the content.