# Git LFS "Authentication required" credentials error in CI

> Fix Git LFS "Authentication required" in CI - the LFS batch endpoint got no usable credentials, so the object fetch is challenged and fails on a non-interactive runner.

Source: https://latchkey.dev/learn/command-reference/git-lfs-authentication-required-token-in-ci  
Updated: 2026-06-30

The LFS server challenged the request for credentials and none were provided. On a CI runner there is no interactive prompt, so the fetch fails immediately with "Authentication required".

## 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 "Authentication required" credentials error in CI?

There are 2 common causes: no token was passed to the checkout and a private repo cloned without credentials. A bare git clone in a step without the persisted credentials from actions/checkout sends anonymous LFS requests that are challenged.

### How do I fix Git LFS "Authentication required" credentials error in CI?

There are 2 fixes depending on which cause you have: let checkout persist credentials and enable lfs and provide credentials for a manual clone. Work through them in order, since the first is the most common.

### What does Git LFS "Authentication required" credentials error in CI actually mean?

A fetch prints "Authentication required: Authentication required for https://github.com/acme/app.git/info/lfs" and the checkout aborts.

### How do I stop Git LFS "Authentication required" credentials error in CI happening again?

Prefer actions/checkout with lfs: true so credentials persist. 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
