# git "fatal: repository not found" on checkout in CI

> Fix git "fatal: repository not found" in CI - the remote returned 404, usually a private repo the token cannot see, a typo in the URL, or a deleted/renamed repository.

Source: https://latchkey.dev/learn/git/gcs-checkout-repository-not-found-in-ci  
Updated: 2026-06-30

GitHub returns a 404 for the remote, and git reports "repository not found". GitHub deliberately returns 404 (not 403) for a private repo the credential cannot access, so this is usually an authorization or naming problem, not a missing repo.

## Diagnose it: depth, refs, or credentials?

```Terminal
git rev-parse --is-shallow-repository
git rev-parse --abbrev-ref HEAD    # prints HEAD when detached
git log --oneline -3
git remote -v
```

> `actions/checkout` fetches depth 1 on a detached HEAD. Anything diffing against a base, reading a branch name, or running `git describe` needs `fetch-depth: 0`.

## FAQ

### What causes git "fatal: repository not found" on checkout in CI?

There are 2 common causes: the token cannot see a private repository and a wrong owner, name, or renamed/deleted repo. GitHub masks private repos as 404 for unauthorized requests.

### How do I fix git "fatal: repository not found" on checkout in CI?

There are 2 fixes depending on which cause you have: grant the token access to the private repo and verify the remote url. Work through them in order, since the first is the most common.

### What does git "fatal: repository not found" on checkout in CI actually mean?

A clone or fetch fails with "remote: Repository not found.

### How do I stop git "fatal: repository not found" on checkout in CI happening again?

Assume "not found" on a private repo means missing access, and check the token scope first. 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
