Git Clone - Repository not found

Solution 1:

As mentioned by others the error may occur if the url is wrong.

However, the error may also occur if the repo is a private repo and you do not have access or wrong credentials.

Instead of

git clone https://github.com/NAME/repo.git

try

git clone https://username:[email protected]/NAME/repo.git


You can also use

git clone https://[email protected]/NAME/repo.git

and git will prompt for the password (thanks to leanne for providing this hint in the comments).

Solution 2:

On macOS it's possible that the cached credentials in the Keychain that git is retrieving are wrong. It can be an outdated password or that it used the wrong credentials.

To update the credentials stored in OS X Keychain

Follow the instructions at:

https://help.github.com/articles/updating-credentials-from-the-osx-keychain/

If you want to verify this is the problem you can run clone with tracing.

$ GIT_CURL_VERBOSE=1 git clone https://github.com/YOUR-USERNAME/YOUR-REPOSITORY

Look for the header line "Authorization: Basic BASE64STRING" .
Take the base64 string and decode it to check what username:password was used.

$ echo <the key> | base64 --decode

Verify it's the right username password you expected to use.

Solution 3:

Most probably, your URL is not valid.

If it is a http/https URL, you can quickly check, by hammering the URL into a browser. If that does not display anything at all, you know that the URL is invalid.

I assume you are speaking of a remote repository. The URLs should look somewhat like these:

https://github.com/user/repo2.git if you're using HTTPS
[email protected]:user/repo2.git if you're using SSH

Solution 4:

If you are using two factor authorization (2FA) for your Github account then just use SSH option for cloning your repository:

enter image description here