Fix: “Remote repository not found” Cloning Error GitHub

The error: remote repository not found occurs while cloning a repository. It can occur due to two particular reasons.

  • URL of the remote repository that you are trying to clone is not correct.
  • You might be cloning a private repository but your user credentials are not correct.

There are other reasons as well due which this error can occur which we will discuss later.

Below, we’ve illustrated several examples of this error alongside their respective solutions. We recommend examining each example and its solution, as they cover most scenarios in which this error occurs.

Example 1: Cloning a wrong URL of a repository: 

Let’s say we are trying to clone a repo on our computer, and we mistakenly enter a wrong URL to clone. We will get this error:

git: remote repository not found

To solve this error, we simply have to go to the GitHub page of the repository that we are trying to clone and click on the code button. Then in the local tab, we click on the clipboard option next to the https field.

Now we can clone that repository by typing in “git clone [URL-of-repository]” and pressing Enter.

Note: Make sure the repository that you are trying to clone is not a private repository as it would need authentication in the form of a private key (as username and password authentication) has been removed from GitHub.

In our scenario, we can simply use “git clone [correct-url-of-repository]” and press enter. Afterward, we can view the contents of the cloned repository by changing the directory to the local cloned repository and executing the “ls” command inside it.

Example 2: Cloning a private repository:

If you are cloning a private repository and facing this error, it is possible that you don’t have the correct credentials for the remote repo to authenticate with and are trying to clone that repository. There are multiple solutions for this scenario.

1. Configure git correctly for authentication

You can set your username and email with the git config command.

You can use this command to set your username:

git config --global "FIRST_NAME LAST_NAME"

To set your email, you can use this command:

git config --global ""

Next, you need to have a valid personal access token for your GitHub account that has read access to the particular repository that you are trying to clone. 

If you don’t have a personal access token yet, you can create it by following these steps: 

  1. Login to your GitHub account
  2. Click on your profile icon and select Settings from there.
  3. Scroll down and click on Developer Settings.
  4. Click on the “Personal access tokens”. You can now select either Fine Grained Access Token or Access Tokens (classic), both will work. Fine grained access tokens can be made for authenticating with only a particular repository. For this tutorial, we will use the “Classic Access Token”.
  5. Click on the Tokens (classic).
  6. Click on Generate New Token on the right hand side of the page and select Generate New Token (classic).
  7. In the note, type anything you want and then select the permissions that you want this token user should have. 
  8. Select all the permissions if you want to have all permissions or you can just select the repo and admin permissions and then click on Generate Token.
  9. Now you will see your personal access token on the page. Click on the clipboard icon next to it to copy that token and save it somewhere on your computer if you want for future use. Make sure no one else has access to your token or they can do anything that you are able to do with your repositories using that token. 

After, you have copied the token and set your username and email, you can simply put in the command:

git clone [url-of-private-repository] 

Git will now ask you for your personal access token, paste the token that you have copied and press Enter. 

The remote repository will now be cloned on your computer. You can then cd into the directory to check whether it’s successful or not.

If the above solutions didn’t fix the problem at your end, you can try these solutions listed below.

Give Read / Write Access to a Repository:

This error can also occur if you are trying to clone a repository to which your user doesn’t have read access. If you are cloning a private repository, make sure your access token has the repo permissions all ticked and then try and clone the repository. 

If someone else has added you to a project on GitHub, ask them to give your user read access so you can clone the repository. If you want to push changes, ensure that your user has write permissions to the repository as well.

Remove Credentials from your System: 

Some users have faced this problem when they had old credentials on their computer while the credentials on have been changed. You can delete the password from the Keychain Access if you are using Mac

If you are using Windows, you can delete the credentials from the credential manager

To delete credentials from credential manager in Windows, follow these steps:

  1. Open Start Menu and search for Control Panel, and then open Control Panel.
  2. Click on Credential Manager
  3. Next click on Windows Credentials.
  4. Under Generic Credentials, clear the credentials referring to
  5. Click on Remove and click yes on the pop window that opens.

To delete a keychain from the KeyChain Access App on Mac, do this:

  1. Open Utilities App in MacOS.
  2. Navigate and select Keychain Access App in the current window. (If the Keychains aren’t visible, click on Window > Keychain Access)
  3. Select the keychain which you want to delete and click on delete keychain. (In your case, it would be the keychain referring to GitHub or any other git remote repository platform)
  4. Click on File and then Delete KeyChain.

If any of the above solutions didn’t fix the problem for you you can view the GitHub docs and as well as the git documentation.

As it would most likely fix the problem for you. If that doesn’t help either, you can always comment on this post and one of our technicians will help you with the problem that you are facing.


Hamza Mohammad Anwar

Hamza Mohammad Anwar is an intermediate JavaScript web developer with a focus on developing high-performance applications using MERN technologies. His skill set includes expertise in ReactJS, MongoDB, Express NodeJS, and other related technologies. Hamza is also a Google IT Certified professional, which highlights his competence in IT support. As an avid problem-solver, he recreates errors on his computer to troubleshoot and find solutions to various technical issues.