Git "Could not read from remote repository" in CI
Git reached the remote but was refused before any repository data was read. The trailing hint about access rights and the repository existing points at credentials or a wrong URL, not a network outage.
What this error means
A git clone or git fetch aborts with fatal: Could not read from remote repository plus the standard hint. It fails the same way on every retry for a given URL and credential.
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.Common causes
Missing or wrong credentials
SSH has no usable key, or the token / credential helper supplies nothing valid, so the remote refuses the connection before reading any data.
Wrong remote URL or the repository does not exist
A typo in the org/repo, a renamed or deleted repository, or pointing at a private repo the runner cannot see all surface as the same generic error.
The identity lacks access to a private repository
The credential is valid but the deploy key, App token, or PAT behind it was never granted access to this specific repository.
How to fix it
Confirm the URL and reachability
- Print the configured remote with
git remote -v. - Probe refs non-destructively with the same credentials the job uses.
git remote -v
git ls-remote https://github.com/org/repo.gitProvide working credentials
- For SSH, load a deploy key or the runner key and add it to the repo or org.
- For HTTPS, supply a token via the credential helper or an x-access-token URL.
- On GitHub Actions, pass an explicit token or ssh-key to actions/checkout for cross-repo clones.
How to prevent it
- Use actions/checkout with an explicit token for cross-repo clones, grant deploy keys and App installations access to every repo a job clones, and pin the exact remote URL in the workflow.