Git: fatal: repository not found
git clone or push dies with 'fatal: repository not found' — but the repo clearly exists. For a private repo that message usually means access, not a missing repo. Here's how to tell which, and fix it.
You clone or push and Git stops:
remote: Repository not found.
fatal: repository 'https://github.com/you/repo.git/' not found
This one is misleading. It doesn't always mean the repository is gone — for a private repo, GitHub deliberately returns "not found" instead of "access denied" so it can't leak which private repos exist. So the real question is: wrong address, or no access?
Cause 1: The URL is wrong
The most common case. Remote URLs are exact and case-sensitive:
git remote -v # what URL is this repo actually pointing at?
Check the owner/organisation, the repo name spelling and case, and the .git suffix. A renamed or moved repo also lands here. Fix it with:
git remote set-url origin https://github.com/correct-owner/correct-repo.git
Cause 2: It's private and you're not authenticated (or lack access)
If the URL is right and the repo is private, "not found" means Git can't prove you're allowed to see it:
- Over HTTPS: your personal access token is missing, expired, or lacks
repo(Contents) access. See our guide on authentication failures. - Over SSH: your key isn't added to the account, or you're pushing as the wrong user. Test with
ssh -T [email protected]— it should greet you by the username that has access. - You genuinely don't have access — you were never added as a collaborator, or you're signed in as the wrong account.
Cause 3: Wrong account on a shared machine
If you have two GitHub accounts (personal and work), Git may be authenticating as the one without access. Check which credentials are cached (git config credential.helper and your OS keychain) and make sure the account with access is the one being used.
Step-by-step
git remote -v— verify the exact owner, name, and case of the URL.- Open that URL in a browser while logged in — can you see the repo? If not, it's access.
- HTTPS → refresh your token; SSH →
ssh -T [email protected]to confirm the right identity. - Fix the URL with
git remote set-urlor fix the credential, then retry.
Frequently Asked Questions
Why does Git say "repository not found" for a repo that clearly exists? Because it's private and Git can't confirm you have access. GitHub returns "not found" rather than "forbidden" on purpose, so it never reveals which private repositories exist. Authenticate with an account that has access and it appears.
What's the difference between "repository not found" and "not a git repository"? "Repository not found" is about the remote — the URL is wrong or you lack access. "not a git repository" is about your local folder not being a repo at all. Different problems, different fixes.
How do I fix it for a private repository?
Make sure you're authenticated as a user with access: over HTTPS use a personal access token with repo/Contents permission; over SSH add your key to that account and confirm with ssh -T [email protected]. Then re-check the remote URL is exactly right.
Stop reading, start building
This pairs with a hands-on BytExplorer course — do it on your own machine and actually keep the skill.