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

> Fix files not going through LFS because the .gitattributes filter=lfs rule is not applied in CI - the attributes file is missing, wrong, or LFS is not initialized.

Source: https://latchkey.dev/learn/command-reference/git-lfs-gitattributes-filter-not-applied-in-ci  
Updated: 2026-06-30

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.

## 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 ".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.

---

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
