Why is Git using the wrong ssh key?

7,910

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

Share:
7,910

Related videos on Youtube

user28795
Author by

user28795

Updated on September 18, 2022

Comments

  • user28795
    user28795 over 1 year

    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?

    • ryekayo
      ryekayo about 6 years
      You can try using ssh-add: ssh-add ~/.ssh/coders-key on your Ubuntu server
    • user28795
      user28795 about 6 years
      coders-key is already on the ubuntu server. but git is using my-key instead for some reason.