Skip to content
LatchkeyLatchkey home

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

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.

What this error means

A clone or fetch fails with "remote: Repository not found. fatal: repository 'https://github.com/org/repo.git/' not found". The URL or owner may be wrong, or the token lacks access to a private repo.

git
remote: Repository not found.
fatal: repository 'https://github.com/acme/analytics-svc.git/' not found

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

Common causes

The token cannot see a private repository

GitHub masks private repos as 404 for unauthorized requests. A token without access to that private repo produces "repository not found" rather than a permission error.

A wrong owner, name, or renamed/deleted repo

A typo in the org or repo name, or a repo that was renamed or deleted, resolves to nothing and returns 404.

How to fix it

Grant the token access to the private repo

  1. Confirm the exact owner/repo in the URL matches the real repository.
  2. Use a PAT or App token whose installation includes that private repo.
  3. Pass it via the token input of actions/checkout for cross-repo checkouts.
.github/workflows/ci.yml
- uses: actions/checkout@v4
  with:
    repository: acme/analytics-svc
    token: ${{ secrets.CROSS_REPO_PAT }}

Verify the remote URL

Print the configured remote to catch a stale owner or a rename before blaming auth.

Terminal
git remote -v
git ls-remote https://github.com/acme/analytics-svc.git

How to prevent it

  • Assume "not found" on a private repo means missing access, and check the token scope first.
  • Keep repository references updated after a rename or transfer.
  • Validate cross-repo names in one place rather than per workflow.

Frequently asked questions

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.

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