git: fatal: Could not read from remote repository :
Your ssh key most likely had been removed from ssh agent
ssh-add ~/.ssh/id_rsa
where id_rsa is a ssh key associated with git repo
Update
You may get Could not open a connection to your authentication agent.
error to resolve that you need to start the agent first by:
eval `ssh-agent -s`
I was facing same issue a while ago…
my .git/config had
url = [email protected]:manishnakar/polymer-demo.git
I replaced it with
url = https://github.com/manishnakar/polymer-demo.git
and it works now:)
You can specify the username that SSH should send to the remote system as part of your remote’s URL. Put the username, followed by an @
, before the remote hostname.
git remote set-url website [email protected]***.com:path/to/repo
Make sure you have correct url in .git/config
url = [email protected]:username/repo.git
If it’s your first push, you’ll need to set up correct upstream
$ git push -u origin master
You can check which key is used by:
$ ssh -vvv [email protected]
The reply should contain something like this:
debug1: Next authentication method: publickey
debug1: Offering RSA public key: ~/.ssh/id_rsa
...
You've successfully authenticated, but GitHub does not provide shell access.
Also it’s possible to define rules for ssh in ~/.ssh/config
, e.g. based on aliases:
Host github
HostName github.com
User git
IdentityFile "~/.ssh/id_rsa"
Host git
HostName github.com
User git
IdentityFile "~/.ssh/some_other_id"
You can set connect to different ports, use different username etc. for each alias.