Ask git to look for a different key than id_rsa

I'm not sure why, but even though I am correctly specifying in the ssh configuration to search for a file named viren.pub for github

git still treats id_rsa as the default and doesn't seem to work until viren.pub and viren are renamed to id_rsa.pub and id_rsa

Here my ssh configuration looks like

Host ec2-123-121-121-121.compute-1.amazonaws.com Hostname github.com User git IdentityFile /root/.ssh/viren 

Can anyone help

+6
source share
1 answer

I believe ssh config is only applicable if you use the alias defined in the host clause to connect to the server.

those. you must have in ssh configuration:

 host github hostname github.com user git identityfile /root/.ssh/viren 

The host directive should follow what you really will use to connect, so the [Amazon server] not suitable. And you have to tell git to connect to:

 github:/.... 

(and not git@github.com :/..... )

+5
source

Source: https://habr.com/ru/post/916330/


All Articles