I think ssh-agent
can only handle one ssh key per session, so it is necessary to run ssh-add -D
to drop all the keys first, and then add the key you want to use with:
ssh-add ~/.ssh/<rsa-key-file>
If your ~/.ssh/config
looks like the following:
# personal
Host github.com
HostName github.com-personal
User git
IdentityFile ~/.ssh/id_rsa_personal
then you can run ssh -T [email protected]
to confirm that your key is successfully authenticated :)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…