How to fix fatal: repository 'https://github.com/user/repo.git/' not found in Git

GitBEGINNERMEDIUMUpdated Dec 6, 2025· 284 views

The 'fatal: repository not found' error occurs when Git cannot locate or access the specified remote repository. This typically happens due to an incorrect URL, insufficient permissions, missing authentication, or the repository being deleted or renamed.

Quick fix

Fixes fatal: repository 'https://github.com/user/repo.git/' not found

# Check your current remote URL
git remote -v

# You should see output like:
# origin  https://github.com/username/repository.git (fetch)
# origin  https://github.com/username/repository.git (push)
  1. Verify the repository URL is correct
  2. Check if the repository is private and verify your access
  3. Authenticate with the Git hosting service
  4. Clear cached credentials and re-authenticate
git — error
# Check your current remote URL
git remote -v
# You should see output like:
# origin https://github.com/username/repository.git (fetch)
# origin https://github.com/username/repository.git (push)
fatal: repository 'https://github.com/user/repo.git/' not found

What this error means

This error indicates that Git could not find the repository at the specified URL. When you run a command like `git clone`, `git pull`, or `git push`, Git attempts to communicate with the remote server to access the repository. This error appears when the server responds that no repository exists at that location. There are several distinct scenarios that trigger this error: 1. **The repository genuinely does not exist** - The URL is incorrect, the repository was deleted, or it was renamed to a different path. 2. **The repository is private and you lack access** - For security reasons, GitHub and other hosting services return a "not found" error instead of "access denied" when you try to access a private repository without proper authentication or permissions. This prevents attackers from discovering which private repositories exist. 3. **Authentication issues** - Your credentials may be expired, incorrect, or not configured properly for the repository URL you're using (HTTPS vs SSH). This error is common when cloning repositories, pushing to remotes for the first time, or when working with repositories after account/permission changes.

Typical symptoms

  • Git clone fails with 'fatal: repository not found'
  • Git pull or fetch fails when trying to update from remote
  • Git push fails when trying to send commits to remote
  • Previously working repositories suddenly show this error
  • CI/CD pipelines fail during git clone or checkout steps
  • Submodule updates fail with repository not found errors
  • Error occurs when switching from SSH to HTTPS URLs or vice versa

Common causes

  1. Typo in the repository URL (wrong username, repository name, or domain)
  2. Repository was deleted or renamed on the hosting service
  3. Repository is private and you don't have read access
  4. Not authenticated to the Git hosting service
  5. Cached credentials are expired or belong to a different account
  6. Using HTTPS URL without proper credential configuration
  7. SSH key not added to your Git hosting account
  8. Repository belongs to an organization with restricted access
  9. Two-factor authentication enabled but not configured for Git
  10. OAuth app restrictions blocking repository access

How to fix "fatal: repository 'https://github.com/user/repo.git/' not found"

1Verify the repository URL is correct

First, double-check that the repository URL is spelled correctly and exists.

bash
# Check your current remote URL
git remote -v

# You should see output like:
# origin  https://github.com/username/repository.git (fetch)
# origin  https://github.com/username/repository.git (push)

Common URL mistakes to check:
- Username typos: github.com/usrname/repo vs github.com/username/repo
- Repository name typos: Repository names are case-sensitive on some platforms
- Wrong organization: Using personal namespace instead of organization name
- Missing .git suffix: Some operations require the .git extension

Visit the repository URL in your browser to confirm it exists. If you get a 404 page, the URL is wrong or the repository doesn't exist.

2Check if the repository is private and verify your access

If the repository is private, you must have explicit access granted by the owner or organization.

To verify your access:
1. Log into the Git hosting service (GitHub, GitLab, Bitbucket, etc.)
2. Navigate to the repository URL directly
3. If you can see the repository, you have access; if you get a 404, you don't

For GitHub:
- Check if you're a collaborator on the repository
- If it's an organization repo, verify your team has access
- Ask the repository owner to add you as a collaborator

For organization repositories:
Some organizations restrict access to members only. Contact your organization administrator if you believe you should have access.

3Authenticate with the Git hosting service

Ensure you're properly authenticated. The method depends on whether you're using HTTPS or SSH.

For HTTPS URLs:

bash
# GitHub - Use a Personal Access Token (PAT)
# Passwords no longer work as of August 2021

# Set up credential caching (stores credentials temporarily)
git config --global credential.helper cache

# Or on macOS, use the keychain
git config --global credential.helper osxkeychain

# On Windows, use the credential manager
git config --global credential.helper wincred

# Try cloning - you'll be prompted for username and PAT
git clone https://github.com/username/repository.git

Creating a Personal Access Token on GitHub:
1. Go to GitHub Settings > Developer settings > Personal access tokens
2. Click "Generate new token (classic)"
3. Select the repo scope for full repository access
4. Copy the token and use it as your password when prompted

For SSH URLs:

bash
# Check if you have an SSH key
ls -la ~/.ssh/id_rsa.pub  # or id_ed25519.pub

# Test SSH connection to GitHub
ssh -T git@github.com

# Expected success message:
# "Hi username! You've successfully authenticated..."

If SSH test fails, add your SSH key to your Git hosting account.

4Clear cached credentials and re-authenticate

Old or incorrect cached credentials can cause authentication to silently fail, resulting in a "not found" error.

On macOS:

bash
# Remove GitHub credentials from Keychain
# Open Keychain Access app and search for "github.com"
# Or use command line:
git credential-osxkeychain erase
host=github.com
protocol=https
# Press Enter twice

# Then try your git operation again - you'll be prompted for new credentials

On Windows:

bash
# Open Credential Manager from Control Panel
# Or use:
git credential-manager-core erase
host=github.com
protocol=https
# Press Enter twice

# Alternative: Uninstall and reinstall credential manager
git credential-manager-core uninstall
git credential-manager-core install

On Linux:

bash
# If using credential cache
git credential-cache exit

# If credentials are stored in a file
# Check and edit ~/.git-credentials

# Remove the stored credential for the specific host
git credential reject
host=github.com
protocol=https
# Press Enter twice
5Switch between HTTPS and SSH URLs

If authentication isn't working with one method, try switching to the other.

Switch from HTTPS to SSH:

bash
# View current remote
git remote -v

# Change to SSH URL
git remote set-url origin git@github.com:username/repository.git

# Verify the change
git remote -v

Switch from SSH to HTTPS:

bash
# Change to HTTPS URL
git remote set-url origin https://github.com/username/repository.git

# Verify the change
git remote -v

URL formats for different services:

| Service | HTTPS | SSH |
|---------|-------|-----|
| GitHub | https://github.com/user/repo.git | git@github.com:user/repo.git |
| GitLab | https://gitlab.com/user/repo.git | git@gitlab.com:user/repo.git |
| Bitbucket | https://bitbucket.org/user/repo.git | git@bitbucket.org:user/repo.git |

6Check if you're using the correct account

You might be authenticated with a different account than the one that has access.

Check your Git configuration:

bash
# Check global user configuration
git config --global user.name
git config --global user.email

# Check local repository configuration
git config user.name
git config user.email

For SSH, check which key is being used:

bash
# List loaded SSH keys
ssh-add -l

# Test GitHub connection with verbose output
ssh -vT git@github.com

If you have multiple GitHub accounts:
You may need to configure SSH to use different keys for different accounts. Create or edit ~/.ssh/config:

bash
# Personal account
Host github.com-personal
  HostName github.com
  User git
  IdentityFile ~/.ssh/id_rsa_personal

# Work account
Host github.com-work
  HostName github.com
  User git
  IdentityFile ~/.ssh/id_rsa_work

Then use the custom host in your remote URL:

bash
git remote set-url origin git@github.com-work:company/repo.git
7Handle two-factor authentication (2FA)

If you have two-factor authentication enabled, you must use a Personal Access Token (PAT) or SSH key - regular passwords won't work.

For HTTPS with 2FA:
1. Generate a Personal Access Token (PAT) as described in Step 3
2. Use the PAT instead of your password when prompted
3. Consider using a credential helper to store the token

For SSH with 2FA:
SSH authentication with keys works normally with 2FA enabled. If you're not already using SSH, consider switching:

bash
# Generate a new SSH key if needed
ssh-keygen -t ed25519 -C "your_email@example.com"

# Start the SSH agent
eval "$(ssh-agent -s)"

# Add your key to the agent
ssh-add ~/.ssh/id_ed25519

# Copy your public key
cat ~/.ssh/id_ed25519.pub
# Add this to your GitHub account under Settings > SSH keys

Advanced notes

### GitHub Returns 404 for Permission Issues

For security reasons, GitHub returns a "repository not found" error (HTTP 404) instead of "permission denied" (HTTP 403) when you try to access a private repository without proper credentials. This prevents attackers from discovering which private repositories exist. If you're certain the repository exists, focus on authentication issues.

### OAuth App Access Restrictions

If the repository belongs to a GitHub organization, access might be restricted by OAuth app policies. Organization owners can restrict which OAuth apps can access organization resources. Contact your organization administrator if you believe this applies to you.

### SSH Agent Forwarding

When working on remote servers, you may need SSH agent forwarding to access repositories:

bash
# Connect with agent forwarding
ssh -A user@remote-server

# Verify agent is available
ssh-add -l

Add this to your local ~/.ssh/config:

bash
Host remote-server
  ForwardAgent yes

### Git Credential Manager

For Windows and macOS, the Git Credential Manager (GCM) provides a more robust solution:

bash
# Check if GCM is installed
git credential-manager-core --version

# Configure Git to use GCM
git config --global credential.helper manager-core

GCM handles OAuth flows, PATs, and multi-account scenarios automatically.

### Submodule Repository Not Found

If you're getting this error for submodules:

bash
# Update submodule URLs in .gitmodules if they've changed
git submodule sync

# Then update submodules
git submodule update --init --recursive

### CI/CD Pipeline Considerations

For automated environments:
- Use deploy keys (SSH keys with repository-specific access)
- Use machine users with appropriate access tokens
- Ensure secrets/tokens are properly configured in your CI/CD system
- Check that tokens haven't expired

bash
# Test authentication in CI before clone
ssh -T git@github.com || echo "SSH auth failed"

### Mirror and Fork Scenarios

If you forked a repository that was later deleted or made private:
- Your fork may lose access to the upstream repository
- Update your remote to point only to your fork
- Or re-fork from a public copy if available

Frequently asked questions

What does "fatal: repository 'https://github.com/user/repo.git/' not found" mean?
This error indicates that Git could not find the repository at the specified URL. When you run a command like git clone, git pull, or git push, Git attempts to communicate with the remote server to access the repository. This error appears when the server responds that no repository exists at that location.
How do I fix "fatal: repository 'https://github.com/user/repo.git/' not found"?
The 'fatal: repository not found' error occurs when Git cannot locate or access the specified remote repository. This typically happens due to an incorrect URL, insufficient permissions, missing authentication, or the repository being deleted or renamed.
What causes "fatal: repository 'https://github.com/user/repo.git/' not found"?
Typo in the repository URL (wrong username, repository name, or domain) Repository was deleted or renamed on the hosting service Repository is private and you don't have read access
Is the "fatal: repository 'https://github.com/user/repo.git/' 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