# Git LFS "files that should have been pointers, but weren't" in CI

> Fix Git LFS "Encountered N file(s) that should have been pointers, but weren't" in CI - files matching an LFS track pattern were committed as raw content, not pointers.

Source: https://latchkey.dev/learn/command-reference/git-lfs-should-have-been-pointers-in-ci  
Updated: 2026-06-30

A file that a `.gitattributes` pattern tracks with LFS was committed as its real bytes instead of a pointer. `git lfs` detects the mismatch and the pre-push hook or a CI check refuses to proceed.

## Using this in CI

CI checkouts are shallow and detached by default, which changes the answer this command gives you. Commands that read history, branch names, or tags need the checkout configured for it.

```.github/workflows/ci.yml
- uses: actions/checkout@v4
  with:
    fetch-depth: 0   # history, tags, and git describe all need this

- run: |
    git rev-parse --is-shallow-repository   # expect false
    git rev-parse --abbrev-ref HEAD          # prints HEAD when detached
```

> `git rev-parse --abbrev-ref HEAD` returns the literal string `HEAD` on a detached checkout rather than a branch name. On GitHub Actions read `github.ref_name` instead; the git command cannot know what it was checked out for.

## FAQ

### What causes Git LFS "files that should have been pointers, but weren't" in CI?

There are 2 common causes: files were committed before lfs tracking was added and a commit bypassed the lfs clean filter. The .gitattributes rule was added after the files were already staged as content, so the real bytes are in history, not pointers.

### How do I fix Git LFS "files that should have been pointers, but weren't" in CI?

There are 2 fixes depending on which cause you have: re-import the paths as pointers and fix a single working copy without a rewrite. Work through them in order, since the first is the most common.

### What does Git LFS "files that should have been pointers, but weren't" in CI actually mean?

A push or a git lfs status check fails with "Encountered N file(s) that should have been pointers, but weren't" and lists the offending paths.

### How do I stop Git LFS "files that should have been pointers, but weren't" in CI happening again?

Add .gitattributes LFS rules before committing matching files. The prevention section lists 3 changes that keep it from recurring.

---

Latchkey runs CI/CD that repairs its own failures. Agent entry points: https://latchkey.dev/agent.txt, https://latchkey.dev/openapi.json, https://latchkey.dev/llms.txt
