I'm currently trying to make multiple keys for a single host, but I am running into an an odd issue where the first SSH key that I decide to use, becomes the only SSH key that I can use. I then have to restart my laptop just to change SSH keys.
I'm using a Macbook Pro with Mojave v10.14.6
My SSH config looks like this -
Host github.com-personal
Hostname github.com
UseKeychain yes
AddKeysToAgent yes
User git
IdentityFile ~/.ssh/personal
Host github.com-work
Hostname github.com
UseKeychain yes
AddKeysToAgent yes
User git
IdentityFile ~/.ssh/work
Since these keys happen to be used for github, I used the following command to test.
ssh -T github.com-work
and
ssh -T github.com-personal
The problem is, if I run the work
command first, the response is -
Hi <<work account>>! You've successfully authenticated, but GitHub does not provide shell access.
After that, if I run either of the above commands, the output is the same.
If I run the personal
command first, then the output references my personal account until I restart my computer.
Does anyone know what's going on here?