DEV Community

Manoj sai Challagulla
Manoj sai Challagulla

Posted on

Troubleshooting Git Authentication: Fixing "Repository Not Found" on Private Repositories

When working with private Git repositories, running into a fatal: repository '...' not found error is incredibly common. It’s a frustrating roadblock, especially when you know the repository exists and that you have access to it in your web browser.

This article walks through why this error happens and exactly how to fix it by clearing outdated credentials in Windows.

The Misconception: user.email vs. Authentication

A common trap many developers fall into is assuming that configuring their global Git identity acts as a login key:

Bash

git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"
Enter fullscreen mode Exit fullscreen mode

The Reality

These commands only sign your work. They act like a handwritten signature at the bottom of a letter—anyone can write any email address they want there.

git config settings are strictly used to stamp a name and profile picture onto commits.

Authentication (cloning, pushing, pulling) relies entirely on separate cryptographic keys or Personal Access Tokens (PATs) managed by your operating system.

When you attempt to clone a private repository and your local machine passes a stale, invalid token, GitHub won't say "Access Denied." For security reasons, it completely masks the repository and returns a Repository not found error so unauthorized users cannot verify a private project's existence.

Step-by-Step Resolution

If you can see the repository perfectly fine in Google Chrome but your terminal throws a not found error, follow these steps to reset your connection.

Step 1: Clear Caching in Windows Credential Manager

Windows caches your Git authentication tokens using a tool called Credential Manager. If your token expires or changes, Windows keeps trying to use the old one anyway.

  1. Press the Windows Key, type Credential Manager, and hit Enter.
  2. Click on Windows Credentials on the right side.
  3. Scroll down to the Generic Credentials section.
  4. Locate the entry named git:https://github.com.
  5. Click the small down arrow (˅) to expand it and click Remove or Delete.

Step 2: Trigger a Fresh Clone

With the broken, cached token completely erased, head back to your terminal and execute your clone command again:

Bash
git clone https://github.com/username/repository-name.git
Enter fullscreen mode Exit fullscreen mode

Step 3: Authorize via Browser OAuth

Because your saved credentials were deleted, Git Credential Manager will instantly prompt an automated browser popup to securely verify your identity.

Click Sign in with your browser on the popup.

Authorize the application on GitHub's secure page.

Note on a common quirk: Once authorized, your browser might display a This site can’t be reached or 127.0.0.1 refused to connect error. You can safely ignore this!

This happens because the temporary background authentication server closed the exact millisecond your token was successfully transferred to your terminal. Check your command line, and you will see the files downloading flawlessly:

Plaintext

Cloning into 'repository'...
info: please complete authentication in your browser...
remote: Enumerating objects: 4913, done.
remote: Counting objects: 100% (306/306), done.
Updating files: 100% (405/405), done.
Enter fullscreen mode Exit fullscreen mode

Conclusion
Next time Git insists a private repository doesn't exist, skip editing your config file and head straight to the Windows Credential Manager. Wiping out the stale git:https://github.com entry forces a clean handshake, getting you back to coding in less than a minute.

Top comments (0)