Skip to content
Latchkey

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.

git
remote: Repository not found.
fatal: repository 'https://github.com/org/private-repo.git/' not found

Common 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

  1. Confirm owner/repo spelling against the GitHub URL.
  2. Run git ls-remote with the same token the job uses to confirm visibility.
Terminal
git ls-remote https://x-access-token:${GH_TOKEN}@github.com/org/repo.git

Grant the credential access

  1. Add the deploy key to the target repo, or install the GitHub App on it.
  2. For PATs, ensure repo scope (classic) or repository access (fine-grained) includes this repo.
  3. 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.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →