Git LFS "batch response: ... 403" authentication error in CI
By Daniel Zoghalchali·Latchkey
The LFS batch endpoint returned 403 Forbidden. The credentials reached the server but the token is not authorized to read (or push) the LFS objects for this repository.
What this error means
checkout or git lfs pull stops with "batch response: Forbidden" and "error: failed to fetch some objects", while ordinary git clone of the pointer files succeeds.
git-lfs
batch response: Forbidden: https://github.com/acme/app.git/info/lfs/objects/batch
error: failed to fetch some objects from 'https://github.com/acme/app.git/info/lfs'
Common causes
The token lacks contents permission
A restricted GITHUB_TOKEN (or a PAT without repo/contents scope) can read pointers over HTTPS but is refused by the LFS batch API, which needs contents access.
LFS objects live in a different repo than the token covers
When objects are stored on a fork or a separate LFS-backing repo, a token scoped only to the current repo is forbidden from those objects.
How to fix it
Grant contents read to the workflow token
Add permissions: contents: read to the workflow or job.
For cross-repo LFS, pass a PAT with access to the object repo via the checkout token input.
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@v4with:fetch-depth:0 # history, tags, and git describe all need this- run:|git rev-parse --is-shallow-repository # expect falsegit rev-parse --abbrev-ref HEAD # prints HEAD when detached
How to prevent it
Set explicit permissions: so the token has contents access for LFS.
Store cross-repo LFS tokens as secrets, not in the workflow.
Prefer the built-in token where the objects live in the same repo.
Frequently asked questions
What causes Git LFS "batch response: ... 403" authentication error in CI?
There are 2 common causes: the token lacks contents permission and lfs objects live in a different repo than the token covers. A restricted GITHUB_TOKEN (or a PAT without repo/contents scope) can read pointers over HTTPS but is refused by the LFS batch API, which needs contents access.
How do I fix Git LFS "batch response: ... 403" authentication error in CI?
There are 2 fixes depending on which cause you have: grant contents read to the workflow token and use a scoped token for cross-repo objects. Work through them in order, since the first is the most common.
What does Git LFS "batch response: ... 403" authentication error in CI actually mean?
checkout or git lfs pull stops with "batch response: Forbidden" and "error: failed to fetch some objects", while ordinary git clone of the pointer files succeeds.
How do I stop Git LFS "batch response: ... 403" authentication error in CI happening again?
Set explicit permissions: so the token has contents access for LFS. The prevention section lists 3 changes that keep it from recurring.