# Git LFS version mismatch on a self-hosted runner in CI

> Fix Git LFS failures caused by an old git-lfs version on a self-hosted runner in CI - stale binaries miss features or protocol behavior that newer servers expect.

Source: https://latchkey.dev/learn/command-reference/git-lfs-self-hosted-runner-version-in-ci  
Updated: 2026-06-30

A self-hosted runner with an outdated `git-lfs` can fail transfers or behave differently from hosted runners: missing flags, older batch behavior, or bugs fixed in later releases. Upgrading the binary resolves it.

## 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 version mismatch on a self-hosted runner in CI?

There are 2 common causes: the runner has an old distro git-lfs package and the binary was never upgraded on the host. A stale OS package pins git-lfs to an old release that lacks flags or fixes the workflow relies on.

### How do I fix Git LFS version mismatch on a self-hosted runner in CI?

There are 2 fixes depending on which cause you have: upgrade git-lfs on the runner and bake a current git-lfs into the runner image. Work through them in order, since the first is the most common.

### What does Git LFS version mismatch on a self-hosted runner in CI actually mean?

LFS operations that work on GitHub-hosted runners fail only on self-hosted ones, and git lfs version shows a much older release than the hosted image.

### How do I stop Git LFS version mismatch on a self-hosted runner in CI happening again?

Pin and periodically bump git-lfs in self-hosted images. 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
