生成ssh-key
// 执行以下指令会生成 git**_id_rsa 和 git**_id_rsa.pub
ssh-keygen -t rsa -C '你的邮箱' -f ~/.ssh/gitee_id_rsa
ssh-keygen -t rsa -C '你的邮箱' -f ~/.ssh/github_id_rsa
在~/.ssh目录下新建名为config的文件,添加如下内容(IdentityFiles指定私钥路径)
# github
HOST github.com
HostName github.com
PreferredAuthentications publickey
User 你的邮箱
IdentityFile ~/.ssh/github_id_rsa
# gitee
HOST gitee.com
HostName gitee.com
PreferredAuthentications publickey
User 你的邮箱
IdentityFile ~/.ssh/gitee_id_rsa
测试ssh,同时根据提示生成konws_host
ssh -T git@github.com