I am in a situation, where I need my msysgit to talk to github with different keys. However git bash insists on using the keyfile named id_rsa ONLY. If I do ssh -vT git@github.com I see only id_rsa being offered.
So whenever I need to use any other key I have to do all this,
ssh-agent bash
ssh-add ~/.ssh/mygithubkey
git clone git@github.com:myaccount/myrepo.git
or rename mygithubkey
to id_rsa
whenever i need it backing up the original id_rsa to another file anotherkey
and of course it is a pain, especially because the command history is also different across the regular git bash.
Other answers in stackoverflow helped only to arrive at my above workaround. If I do
ssh-add ~/.ssh/mygithubkey
directly in my git bash, it says could not connect to ssh-agent. If I do
ssh-agent ssh-add ~/.ssh/mygithubkey
git pull
ssh -vT git@github.com
directly in my git bash, it says permission denied, it seems ssh-add
did not really add the key permanently! And the added key is not offered while looking at the debug messages in verbose mode.
Is there anyway to permanently add a list of ssh keys to offer, when sshing into github? Im mostly a windows user today, so please be verbose in the answer.