Skip to content
LatchkeyLatchkey home

Git LFS ".gitattributes filter=lfs" not applied in CI

Files that should route through LFS are stored as raw content because the filter=lfs attribute is not in effect. The .gitattributes may be missing, the pattern may not match, or LFS filters are not registered.

What this error means

git check-attr filter -- path shows no lfs filter, or committed files that should be pointers contain raw bytes despite an intended track rule.

git-lfs
$ git check-attr filter -- assets/model.bin
assets/model.bin: filter: unspecified
# expected: filter: lfs

Common causes

The .gitattributes rule is missing or mismatched

No committed rule matches the path, or the pattern is scoped to a subdirectory that does not cover the file, so filter=lfs never applies.

LFS filters are not registered on the runner

Without git lfs install, the clean/smudge filters are not wired up, so even a correct attribute does nothing.

How to fix it

Add the track rule and initialize LFS

  1. Run git lfs track for the pattern so a correct .gitattributes line is added.
  2. Commit .gitattributes.
  3. Ensure git lfs install has registered the filters on the runner.
Terminal
git lfs install
git lfs track "*.bin"
git add .gitattributes
git check-attr filter -- assets/model.bin

Correct the pattern scope

Make the track pattern broad enough to match the file, or place a .gitattributes in the right directory so the rule applies.

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

How to prevent it

  • Commit .gitattributes with correct filter=lfs patterns.
  • Run git lfs install during runner setup.
  • Verify with git check-attr filter in CI for critical paths.

Frequently asked questions

What causes Git LFS ".gitattributes filter=lfs" not applied in CI?
There are 2 common causes: the .gitattributes rule is missing or mismatched and lfs filters are not registered on the runner. No committed rule matches the path, or the pattern is scoped to a subdirectory that does not cover the file, so filter=lfs never applies.
How do I fix Git LFS ".gitattributes filter=lfs" not applied in CI?
There are 2 fixes depending on which cause you have: add the track rule and initialize lfs and correct the pattern scope. Work through them in order, since the first is the most common.
What does Git LFS ".gitattributes filter=lfs" not applied in CI actually mean?
git check-attr filter -- path shows no lfs filter, or committed files that should be pointers contain raw bytes despite an intended track rule.
How do I stop Git LFS ".gitattributes filter=lfs" not applied in CI happening again?
Commit .gitattributes with correct filter=lfs patterns. The prevention section lists 3 changes that keep it from recurring.

Related guides

References

Not every red build is your code. Latchkey repairs the ones that are not, on the runner. Start free → 30-day trial · No credit card