i have multiple ssh keys and i have also have account on bitbucket and github. how when ever i use pull it gives me error
:/var/www/proj$ git pull origin master
conq: repository access denied.
fatal: The remote end hung up unexpectedly
or if i ssh the bitbucket website it gives errors ass public key denied
:~$ ssh git@bitbucket.org
Permission denied (publickey).
how can i get this resolved and use different keys with different accounts.
Best Answer
This is all gathered from website and stackoverflow, hope this helps who are new to ssh
so you can have many ssh keys
Note: we need to add then to the ssh-agent, probably id_rsa will be added so we need to add the other private key
now we have added both ssh keys to ssh-agent
we have one for bitbucket and one for github
so we create a config file like this
Note: I am using 2 different keys for 2 different account on bitbucket and one for github.
Now we need to tell the git repository which host to use so that I will get that specific ssh key for that specific account
change
git@bitbucket.orgyyyuser/yyyproject.git
togit@bit-yyyuser:yyyuser/yyyproject.git
so in the project folder and add the remote url
in other project
now you can use push and pull easily
and another project
now I dont have the github project on the local machine so we need to clone the project but we need to make a little change to the url to clone
our url is like this
as we have to clone it with specific keys we just need to change the host name with the host we have defined
as defined in the config file
and now we can clone
we have identified different ssh keys for different host, one for git and one for bitbucket now the system knows which ssh keys to be used with which host.
Now we can easily pull, push.