I have 2 git accounts on my mac for which I have 2 sets of public and private keys.
I have a config file in /.ssh to manage those accounts, which looks like this:
Host github.com
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa
Host github-user2
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_user2
Code from these accounts are to be pushed to 2 different remote repositories for which I set their different remotes in their respective directories using following command:
git remote add origin github.com:xyz_user/abc.git
git remote add origin github-user2:pqr_user/def.git
I am successfully able to push to these repos from both accounts.
When I use ssh,
ssh-add -l
shows private keys for both of the accounts added.
But
ssh -T github.com
ssh -T github-user2
both gives the following message:
"Hi user2! You've successfully authenticated, but GitHub does not provide shell access."
1 more thing that I have noticed, even If there is no key listed with " ssh-add -l"
ssh -T github.com & ssh -T github-user2 provide successful authenticate message.
How will I differentiate between both the accounts while making ssh connection?
Where does ssh -T authenticate from?