I am getting this error -
D:\Projects\wamp\www\REPO [master]> git pull origin master
Warning: Permanently added 'github.com,192.30.252.128' (RSA) to the list of known hosts.
ERROR: Repository not found.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
The output of git remote -v
D:\Projects\wamp\www\REPO [master]> git remote -v
origin [email protected]:username/repo.git (fetch)
origin [email protected]:username/repo.git (push)
Final message of ssh -Tv [email protected] command -
Hi [My Username]! You've successfully authenticated, but GitHub does not provide shell access.
How can I solve it?
For me none of the solutions here solved it. Frustrated, I restarted my Macbook's iTerm terminal, and voila! My github authorization started working again.
Weird, but maybe iTerm has its own way of handling SSH authorizations or that my terminal session wasn't authorized somehow.
I got the very same errors too. In My case upgrading from Windows 7 to 8 messed up my settings. What helped was to regenerate the private and public SSH keys using PuTTYGen, and change the SSH tool in tortoisegit from SSH to Plink.
I have shared the step by step steps also at http://techblog.saurabhkumar.com/2015/09/using-tortoisegit-on-windows-with.html
change your ssh url by an http url for your remote 'origin', use:
> git remote set-url origin https://github.com/<user_name>/<repo_name>.git
It will ask for your GitHub password on the git push.
Sometimes that (copying the pub ssh key to github/bitbucket) is not enough, particularly with Bitbucket. You also may need to check if your ssh is using the identity you expect rather than messing up with git remote
Check if the agent is using the same identity you pasted on github/bitbucket with ssh-add -l
. If missing add it with
ssh-add ~/.ssh/id_rsa_my_git_identity
Further details: https://confluence.atlassian.com/bitbucket/configure-multiple-ssh-identities-for-gitbash-mac-osx-linux-271943168.html
This issue could be related with missing SSH key at Github or any other git server.
In my case I had copied code to another computer and tried to git pull
. It failed.
So I had to generate a new SSH key on that machine and update profile on git server with additional SSH key.
This error happened to me too as the original repository creator had left the company, which meant their account was deleted from the github team.
git remote set-url origin https://github.com/<user_name>/<repo_name>.git
And then
git pull origin develop
or whatever git command you wanted to execute should prompt you for a login and continue as normal.
This error can be because of no SSH key on the your local machine. Check the SSH key locally:
$ cat ~/.ssh/id_rsa.pub
If above command do not give any output use below command to create ssh key(Linux/Mac):
$ ssh-keygen
Now again run cat ~/.ssh/id_rsa.pub This is your SSH key. Copy and add this key to your SSH keys in on git. In gitlab/bitbucket go to
profile settings -> SSH Keys -> add Key
and add the key
I had this issue and tried many things but still din't work. Eventually I decided to generate another SSH KEY
and boom - it worked. Follow this article by github to guide you on how to generate your SSH KEY.
Lastly don't forget to add it to your github settings. Click here for a guide on how to add your SSH KEY
to your github account.
not right way
git remote set-url origin [email protected]:erhandemirciinstagram/..
right way
git remote set-url origin https://[email protected]/..
Maybe, as in my silly situation, you may somehow created the ssh key by directly typing
ssh-keygen
And so it is created with the local system user credentials so they don't match, use full command like this and recreate
ssh-keygen -t rsa -b 4096 -C "[email protected]"
Try:
git config --global credential.helper cache
This command prevents git to ask username and password, not forever but with a default limit to 15 minutes.
git config --global credential.helper 'cache --timeout=3600'
This moves the default limit to 1 hour.
This usually happens when you use two ssh keys to access two different GitHub account.
Follow these steps to fix this it look too long but trust me it won't take more than 5 minutes:
Step-1: Create two ssh key pairs:
ssh-keygen -t rsa -C "[email protected]"
Step-2: It will create two ssh keys here:
~/.ssh/id_rsa_account1
~/.ssh/id_rsa_account2
Step-3: Now we need to add these keys:
ssh-add ~/.ssh/id_rsa_account2
ssh-add ~/.ssh/id_rsa_account1
- You can see the added keys list by using this command:
ssh-add -l
- You can remove old cached keys by this command:
ssh-add -D
Step-4: Modify the ssh config
cd ~/.ssh/
touch config
subl -a config
or code config
or nano config
Step-5: Add this to config file:
#Github account1
Host github.com-account1
HostName github.com
User account1
IdentityFile ~/.ssh/id_rsa_account1
#Github account2
Host github.com-account2
HostName github.com
User account2
IdentityFile ~/.ssh/id_rsa_account2
Step-6: Update your .git/config
file:
Step-6.1: Navigate to account1's project and update host:
[remote "origin"]
url = [email protected]:account1/gfs.git
If you are invited by some other user in their git Repository. Then you need to update the host like this:
[remote "origin"]
url = [email protected]:invitedByUserName/gfs.git
Step-6.2: Navigate to account2's project and update host:
[remote "origin"]
url = [email protected]:account2/gfs.git
Step-7: Update user name and email for each repository separately if required this is not an amendatory step:
Navigate to account1 project and run these:
git config user.name "account1"
git config user.email "[email protected]"
Navigate to account2 project and run these:
git config user.name "account2"
git config user.email "[email protected]"
ssh-add -D # Delete all identities.
ssh-add ~/.ssh/your_key
Edit 1
Since I get so many votes, I discovered some issue with this approach and that is that it will remove all your identities so you might have the same issue when you try to read from other repositories and you will need to to this step again for each project...but it might also not be the case for your project
Strangely I had this occur with a single repository out of > 20 repositories on my MacBook Pro.
The solution was to upgrade git via homebrew, and everything strangely worked after it finished:
brew install git
Hope this helps someone!
Its not necessary to apply above solutions, I simply changed my internet, it was working fine with my home internet but after 3 to 4 hours my friend suggest me to connect with different internet then I did data package and connect my laptop with it, now it is working fine.
In my case updating GIT helps - I had version 2.23 and with installing version 2.26.2.windows.1 problem disapears.
So if you are sure your SSH key is valid then (see @VonC answer):
And it should be ok.
Sometimes this happens to me because of network problems. I don't understand the problem fully, but switching to a different sub-network or using VPN solves it
Source: Stackoverflow.com