Git "Repository not found" in CI
GitHub returns "Repository not found" both when a repo truly does not exist and when your credential cannot see a private one. The message is deliberately ambiguous so it does not leak the existence of private repositories.
What this error means
A clone or fetch over HTTPS fails immediately with remote: Repository not found followed by fatal: repository not found. Public repos clone fine; a specific private repo does not.
remote: Repository not found.
fatal: repository 'https://github.com/org/private-repo.git/' not foundCommon causes
Wrong owner or repository name
A typo, a renamed repo, or a moved org path. The URL points at something that does not resolve for the caller.
Private repo, credential without access
A PAT, App token, or deploy key that is valid but not granted access to this private repository returns "not found" rather than a 403.
Default GITHUB_TOKEN scoped to the wrong repo
On Actions, the automatic token only covers the current repository; cross-repo clones need an explicit token or App installation.
How to fix it
Verify the path and access with the job credential
- Confirm owner/repo spelling against the GitHub URL.
- Run
git ls-remotewith the same token the job uses to confirm visibility.
git ls-remote https://x-access-token:${GH_TOKEN}@github.com/org/repo.gitGrant the credential access
- Add the deploy key to the target repo, or install the GitHub App on it.
- For PATs, ensure repo scope (classic) or repository access (fine-grained) includes this repo.
- For cross-repo Actions clones, pass a PAT or App token to actions/checkout instead of the default token.
How to prevent it
- Use fine-grained tokens or App installations scoped to exactly the repos a job needs, and template the org/repo path from variables so a rename is a one-line change.