git "fatal: repository not found" on checkout in CI
By Daniel Zoghalchali·Latchkey
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
Confirm the exact owner/repo in the URL matches the real repository.
Use a PAT or App token whose installation includes that private repo.
Pass it via the token input of actions/checkout for cross-repo checkouts.
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.