I have 2 github accounts in the same computer, I want to be able to provide the user with which I wish to authenticate (i.e ssh userA@github
or ssh userB@github
). This works fine with the following .ssh/config file:
Host github.com
Hostname github.com
PreferredAuthentications publickey
IdentityFile .ssh\userA_key
User userA
Host github.com
Hostname github.com
PreferredAuthentications publickey
IdentityFile .ssh\userB_key
User userB
However, if I authenticate with the git user (i.e. ssh git@github.com
). I get a successfully authenticated message with the user that appears first in the config file (userA). Is there a way to prevent this? I want to provide either userA or userB, and not being able to authenticate as git user.