I have two ssh keys on my laptop: work.pub for work (and it is attached to my GitHub work account) and personal.pub (for personal usage and personal GitHub account). Also I am using macOS 11.0.1.
I have following .ssh/config:
Host *
UseKeychain yes
AddKeysToAgent yes
IdentityFile ~/.ssh/personal
IdentityFile ~/.ssh/work
I have added both ssh keys to Keychain with:
ssh-add -K ~/.ssh/work
ssh-add -K ~/.ssh/personal
Still, when I tried to push to personal
repo on GH I get error than my_work_github_username
does not allowed to push (here I expected that my personal ssh key would take precedence)
After it failed I deleted all identities from Keychain and tried to push one more time:
ssh-add -D
It pushed to personal .git, but with work
identity (git commit showed my work
avatar and nickname, but I was expecting it to show my personal
pic and nickname)
What am doing wrong? How to be able to use multiple keys on one system?
Thanks!