For me it worked by removing the credential.helper
config and cloning the repository again
git config --global --unset credential.helper
git clone https://<repository>
git clone https://<USERNAME>@github.com/<REPONAME>/repo.git
This works fine. Password need to provide.
This is happening because of my old session state of other user remain: Below is quick solution for Windows users,
Open Control Panel from the Start menu Select User Accounts Select "Manage your credentials" in the left hand menu Delete any credentials related to Git or GitHub
Once I did this, it started working for me.
If you are on Windows, the repository is private, and different or not longer correct credentials were saved once, you won't have access to the repo. You will get the not found error without hinting in the failed-credential-direction. In order to reset the credentials on Windows, open Control Panel (Win+r control), select User Accounts and Credentials Manager. Locate the git account in Windows credentials (not Web credentials!) and erase this entry.
After that, cloning will pop up a login dialogue and you will be able to set these again.
Tested this with git-bash as shell in VSCode
open Credential Manager -> look for your GIT devops profile -> click on it -> edit -> add user and password generated in DevOps and save.
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
Another reason for this error, if you are on github, and trying to use deploy keys for multiple repos, you will find this does not work.
In that case you need to create a machine user, however if you don't and you try to clone any repo besides the one with the deploy key, you will get this error.
Step 1: Copy the link from the HTTPS
Step 2: in the local repository do
git remote rm origin
Step 2: replace github.com with [email protected] in the copied url
Step 3:
git remote add origin url
git clone https://[email protected]/User/Repository.git
will prompt for a password then clone.
if your git repo is private, try this
git clone https://<USERNAME>:<PASSWORD>@github.com/<USERNAME>/<REPO_NAME>.git
Note: If you are using @ symbol in your password, use '%40' to instead '@'
else use this
git clone https://github.com/<USERNAME>/<REPO_NAME>.git
What solved my problem, since I was having a "redirect/sign_in URL" or "repository not found" error
MacOS Users:
Windows users should try similar steps, but Keychain would be Microsoft's Credentials Manager instead or Windows Credentials depending on yours OS version. Make sure to clean both web and windows credentials if that's the case.
For me the problems occurs because I have my old username/password settings saved for gitlab, so that I need to remove those credentials. I run the following command on my mac:
sudo su
git config --system --unset credential.helper
and do the clone again, enter the username and password. And everything is fine.
Authentication issue: I use TortoiseGit GUI tool, I need to tell tortoise the username and password so that it can access to work with Git/GitHub/Gitlab code base. To tell it, rt click inside any folder to get TortoiseGit menu. Here TortoseGit > Settings Window > Select Credentials in left nav tree Enter URL:Git url Helper: Select windows if your windows credentials are same as the ones for Git or 'manager' if they are different userName; Git User Name Save this settings ans try again. You will be prompted for password and then it worked.
I'm a devops engineer and this happens with private repositories. Since I manage multiple Github organizations, I have a few different SSH keys. To overcome this ERROR: Repository not found. fatal: Could not read from remote repository.
error, you can use
export GIT_SSH_COMMAND="ssh -o StrictHostKeyChecking=no -o User=git -i ~/.ssh/ssh_key_for_repo"
git clone [email protected]:user/repo.git
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).
For me
git clone https://[email protected]/name/repo.git
worked.
I think this mainly happens because Private repo can't be accessed directly.
You should check if you have any other github account marked as "default". When trying to clone a new repo, the client (in my case BitBucket) will try to get the credentials that you have set "as default". Just mark your new credentials "as default" and it will allow you to clone the repo, it worked for me.
This issue started surfacing on my terminal after I enabled GitHub 2FA.
Now, I face this issue whenever I clone a private repository. This error:
remote: Repository not found.
fatal: repository 'https://github.com/kmario23/repo-name.git/' not found
is so awkward. Of course, I have this repo and I'm the owner of it.
Anyway, it seems the fix is now that we have to enter the GitHub username
one more time when cloning a private repo. Below is an example:
add your username
|-------|
$ git clone --recursive https://[email protected]/kmario23/repo-name.git
You may need to create an empty file named git-daemon-export-ok
within the repository directory.
Possibly you did login in another account, and that account doesn't have access rights to this repo, if you're using mac os, go to Keychain Access, search for gitlab.com and remove it and try to git clone again.
If you are using cygwin for git and trying to clone a git repository from a network drive you need to add the cygdrive path.
For example if you are cloning a git repo from z:/
$ git clone /cygdrive/z/[repo].git
I had the same problem (Repository not found
) due to the fact that initially I logged in with an incorrect GitHub account. To fix it:
In my case. repository is private I can't access it directly. On ly way to use Github Desktop app to fetch this repo.
On github you can have the main repository and subfolders. Make sure that the URL that you are using is that of the main repository and not that of a folder. The former will succeed and the latter will produce the repository not found error. If you have a doubt you are in a subfolder, navigate up the repository chain till you find a page which actually specified the https URL and use that.
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.
Follow the instructions at:
https://help.github.com/articles/updating-credentials-from-the-osx-keychain/
$ 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.
I was also having same issue. I was trying to clone the repo which was private and my git installed in osx has keychain which was not allowing me to clone the repo...
I tried
git clone https://username:[email protected]/NAME/repo.git
but it didn't work as my password was containing the field @.
I just ran
git credential-osxkeychain erase
host=github.com
protocol=https
command and press enter and it worked perfectly fine. Actually you need to remove the keychain already stored in the osx.
Source: Stackoverflow.com