Add existing ssh key for git

Solution 1:

To get remote access to a server it needs to know about your key. Therefor you have a private key and the server has the public key in its ~/.ssh/authorized_keys The reason why your friend gets access is probably because he has uploaded his public key to the server.

But your friend probably doesnt want you to have his private key - because then you could authenticate as him on all servers he has uploaded his public key to.

So to get access - you need to upload your public key into the account that you are using.

If this is a plain ssh server - then you can scp it over and append the key to the '~/.ssh/authorized_keys'. In which case the content of the file now will contain two keys.