同一台电脑使用多个ssh连接git,出现权限不够的问题

在本地使用多个ssh连接git时出现如下错误:

Permission denied (publickey,gssapi-keyex,gssapi-with-mic)

当一台电脑上同时使用多个ssh key时,需要通过ssh-add将其他的私钥添加到列表中,因为默认只会识别id_rsa私钥


使用如下命令添加

ssh-add ~/.ssh/id_rsa_git_hub

如果在添加过程中出现 Could not open a connection to your authentication agent. 错误,
请参考 :
使用ssh-add命令添加ssh私钥时报错

 

原文地址:https://www.cnblogs.com/tommy-huang/p/8584063.html