I'm trying to set up personal git account along with my work account. I followed this guide https://www.freecodecamp.org/news/manage-multiple-github-accounts-the-ssh-way-2dadc30ccaca/ and my ~/.ssh/config is (some-name is my user name for personal github account)
host github.com
Hostname github.com
User git
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_rsa
host some-name.github.com
Hostname github.com
Identityfile ~/.ssh/id_rsa_personal
After this, I ran ssh-add ~/.ssh/id_rsa_personal
which was successful.
However, when I do ssh -T some-name.github.com
, it fails with
somename@github.com: Permission denied (publickey)
The work account is working fine. I also uploaded newly generated public key on github account.
My git config --list shows user.name=some-name.
update: based on VonC's response, I was able to get ssh -T some-name.github.com
to run successfully. However, I am still getting following error when I try to push code into a repo in github account.
ERROR: Permission to some-name/docker-react.git denied to User.
fatal: Could not read from remote repository.
I checked the ssh keys uploaded on github, and it is correct.