进入到 ~/.ssh
目录下
若没有该目录则手工创建
Git Bash Here
执行命令
ssh-keygen -t rsa -C "[email protected]" -f "github_id_rsa"
ssh-keygen -t rsa -C "[email protected]" -f "gitee_id_rsa"
执行命令后会在改目录下生成 ssh
的 public key
文件
设置 public key
打开 gitee_id_rsa.pub
文件,将内容复制到gitee的ssh中保存
同样,打开 github_id_rsa.pub
文件,将内容复制到gitee的ssh中保存
创建config文件解决ssh冲突
创建名为config的文件,注意没有后缀名,内容如下:
# gitee
Host gitee.com
HostName gitee.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/gitee_id_rsa
# github
Host github.com
HostName github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/github_id_rsa
测试
测试gitee命令:
ssh -T [email protected]
测试GitHub命令:
ssh -T [email protected]
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。