On my Windows PC, I am using Pageant and putty to login to a remote ubuntu with my ssh key (e.g. named my-key).

On ubuntu I would like to fetch code from a remote git repository via ssh. There is a local ssh key in ~/.ssh for that user (e.g. named coders-key) which is supposed to be used with the remote git repository.

For some reason, git is using the key I used to login to the ubuntu (my-key) instead of using the key from the ~/.ssh folder.

How can I make git use the ssh key from ~/.ssh?

  • 1
    You can try using ssh-add: ssh-add ~/.ssh/coders-key on your Ubuntu server – ryekayo Feb 14 '18 at 14:59
  • coders-key is already on the ubuntu server. but git is using my-key instead for some reason. – user28795 Feb 14 '18 at 15:07

The reason is SSH Agent Forwarding (https://developer.github.com/v3/guides/using-ssh-agent-forwarding/).

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.