效果:不同账号配置不同的密钥,不同账号配置不同密钥
生成不同的SSH私钥
// 生成GitHub ssh-keygen -t rsa -C "xxx@qq.com" -f "github_id_rsa" ssh-keygen -t rsa -C "xxx@qq.com" -f "gitee_id_rsa"
多账号必须配置config文件
# gitee Host gitee.com HostName gitee.com PreferredAuthentications publickey IdentityFile ~/.ssh/id_rsa.gitee # github Host github.com HostName github.com PreferredAuthentications publickey IdentityFile ~/.ssh/id_rsa.github
测试是否连接正常
ssh -T git@github.com ssh -T git@gitee.com
参考:https://www.cnblogs.com/ryanliag/p/13036433.html