Skip to content
LatchkeyLatchkey home

Git LFS clean filter slow / stalls commit in CI

The LFS clean filter hashes and stores each large file when it enters the index. On a job that adds or checks out many big files, this serial work can dominate runtime and look like a stall.

What this error means

A commit or checkout step in CI takes far longer than expected while LFS processes files, with little log output between "Filtering content" lines.

git-lfs
Filtering content: 100% (18/40), 3.2 GiB | 6.0 MiB/s
# job appears stalled while the clean filter hashes remaining large files

Common causes

Many large files processed one at a time

The clean filter runs per file; a large batch of big objects serializes the hashing and storage work.

No object cache between runs

Without a cached .git/lfs, every run re-fetches and re-processes the same objects, multiplying the cost.

How to fix it

Cache LFS objects and raise concurrency

  1. Cache .git/lfs so processed objects persist across runs.
  2. Raise lfs.concurrenttransfers so fetches parallelize.
  3. Limit which jobs enable LFS so only those that need it pay the cost.
.github/workflows/ci.yml
git config lfs.concurrenttransfers 8
# cache step
- uses: actions/cache@v4
  with:
    path: .git/lfs
    key: lfs-${{ github.sha }}

Fetch only what the job needs

Use include/exclude filters so a job pulls just the objects it uses instead of the whole set.

Terminal
git lfs pull --include="assets/build/*" --exclude="assets/raw/*"

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

  • Cache .git/lfs between CI runs.
  • Scope LFS fetches with include/exclude patterns.
  • Keep LFS enabled only on jobs that read the binaries.

Frequently asked questions

What causes Git LFS clean filter slow / stalls commit in CI?
There are 2 common causes: many large files processed one at a time and no object cache between runs. The clean filter runs per file; a large batch of big objects serializes the hashing and storage work.
How do I fix Git LFS clean filter slow / stalls commit in CI?
There are 2 fixes depending on which cause you have: cache lfs objects and raise concurrency and fetch only what the job needs. Work through them in order, since the first is the most common.
What does Git LFS clean filter slow / stalls commit in CI actually mean?
A commit or checkout step in CI takes far longer than expected while LFS processes files, with little log output between "Filtering content" lines.
How do I stop Git LFS clean filter slow / stalls commit in CI happening again?
Cache .git/lfs between CI runs. 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