How to fix fatal: repository 'https://github.com/user/repo' not found in Git
This error appears when Git cannot access a remote repository due to authentication issues, missing permissions, or an incorrect URL. The fix typically involves verifying your credentials or requesting repository access.
Quick fix
Fixes fatal: repository 'https://github.com/user/repo' not found
# Check your current remote URL
git remote -v- Verify the repository URL exists
- Check your authentication status
- Re-authenticate or update credentials
- Create and use a Personal Access Token (PAT)
# Check your current remote URLgit remote -vfatal: repository 'https://github.com/user/repo' not found
What this error means
This error occurs when Git cannot locate the remote repository at the specified URL. The message "fatal: repository not found" is somewhat misleading because it can appear not only when the repository truly doesn't exist, but also when you lack proper authentication or authorization to access it. GitHub, GitLab, and other hosting providers return this generic "not found" message for security reasons: they don't reveal whether a private repository exists if you don't have access to it. This means the same error can indicate a genuine typo in the URL, a deleted repository, or simply that your credentials are incorrect or expired. If you previously had access to a repository and suddenly receive this error, the most likely cause is an authentication problem—perhaps an expired Personal Access Token, recently enabled Two-Factor Authentication, or cached credentials that no longer work.
Typical symptoms
- Git clone command fails with "repository not found" message
- Git push fails even though you have local commits
- Git fetch or pull operations cannot reach the remote
- Error appears for both HTTPS and SSH URLs
- Private repository appears to not exist despite being created
Common causes
- Authentication credentials are missing, expired, or incorrect (most common)
- You are not a collaborator on a private repository
- The repository URL contains a typo or case mismatch
- The repository was deleted, renamed, or transferred to another owner
- Personal Access Token (PAT) is missing required scopes
- Two-Factor Authentication (2FA) was recently enabled but credentials were not updated
- Cached credentials in Git Credential Manager are stale
- SSH key is not added to your GitHub/GitLab account or lacks organization approval
How to fix "fatal: repository 'https://github.com/user/repo' not found"
Open the repository URL in your browser to confirm it exists and you have access:
# Check your current remote URL
git remote -vIf the repository was renamed or transferred, update the URL:
git remote set-url origin https://github.com/correct-user/correct-repo.gitTest if you can authenticate with GitHub/GitLab:
For SSH:
ssh -T git@github.com
# Should respond: "Hi username! You've successfully authenticated"For HTTPS (GitHub CLI):
gh auth statusIf authentication failed, re-authenticate:
Using GitHub CLI (recommended):
gh auth loginClear cached credentials and try again:
*Windows (Credential Manager):*
1. Open Control Panel > Credential Manager
2. Remove entries for github.com or gitlab.com
*macOS (Keychain):*
git credential-osxkeychain erase
host=github.com
protocol=https
# Press Enter twice*Linux:*
git config --global --unset credential.helperGitHub no longer accepts passwords for Git operations. Create a PAT:
1. Go to GitHub Settings > Developer settings > Personal access tokens > Tokens (classic)
2. Click Generate new token
3. Select scopes: at minimum repo (full control of private repos)
4. Generate and copy the token
Use the token as your password when prompted:
git clone https://github.com/user/repo.git
# Username: your-username
# Password: paste-your-token-hereOr embed it in the URL (for scripts):
git clone https://your-token@github.com/user/repo.gitIf it's a private repository you don't own, request access:
1. Contact the repository owner or organization admin
2. Ask to be added as a Collaborator (for personal repos) or to the appropriate Team (for org repos)
3. Accept the invitation sent to your email
4. Try cloning again after access is granted
Sometimes switching protocols resolves authentication issues:
Switch to SSH:
git remote set-url origin git@github.com:user/repo.gitSwitch to HTTPS:
git remote set-url origin https://github.com/user/repo.gitIf using SSH, ensure your key is added:
# List SSH keys
ls -la ~/.ssh/
# Add key to ssh-agent
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519Advanced notes
Why "repository not found" instead of "access denied"?
Git hosting services intentionally use vague "not found" errors for security. Revealing that a private repository exists (but you lack access) would leak information to potential attackers. This design choice, while secure, makes troubleshooting harder.
Organization-owned repositories and SAML SSO:
If your organization uses SAML Single Sign-On, your Personal Access Token must be explicitly authorized for SSO access. After creating a PAT, click "Configure SSO" next to the token and authorize it for your organization.
SSH keys and OAuth applications:
SSH keys generated by third-party Git clients (like GitKraken) may be tied to an OAuth application. These keys require explicit organization approval if you're accessing org-owned repositories. Consider generating a standard SSH key pair independently.
Enterprise Server vs GitHub.com:
Ensure you're using the correct host. GitHub Enterprise Server installations have different URLs (e.g., github.mycompany.com instead of github.com). Credentials don't transfer between instances.
Fine-grained PATs:
GitHub's newer fine-grained Personal Access Tokens require explicit repository permissions. If you created a fine-grained PAT, verify it grants access to the specific repository you're trying to reach.
Frequently asked questions
- What does "fatal: repository 'https://github.com/user/repo' not found" mean?
- This error occurs when Git cannot locate the remote repository at the specified URL. The message "fatal: repository not found" is somewhat misleading because it can appear not only when the repository truly doesn't exist, but also when you lack proper authentication or authorization to access it. GitHub, GitLab, and other hosting providers return this generic "not found" message for security reasons: they don't reveal whether a private repository exists if you don't have access to it.
- How do I fix "fatal: repository 'https://github.com/user/repo' not found"?
- This error appears when Git cannot access a remote repository due to authentication issues, missing permissions, or an incorrect URL. The fix typically involves verifying your credentials or requesting repository access.
- What causes "fatal: repository 'https://github.com/user/repo' not found"?
- Authentication credentials are missing, expired, or incorrect (most common) You are not a collaborator on a private repository The repository URL contains a typo or case mismatch
- Is the "fatal: repository 'https://github.com/user/repo' not found" error serious?
- It is a medium-severity error — more of a blocker than a risk. The steps above resolve it.
Official resources & further reading
- 📚Git Official Documentation
- 🔗
- 💬Stack Overflow: git remote repository not found(Stack Overflow)
- 📝