秘钥的配置一般在:~/.ssh/ 目录下生成公钥(.pub)和私钥文件
本地生成秘钥:ssh-keygen -t rsa -C "邮箱" ;生成的文件默认是id_rsa
ssh-keygen -t rsa -C "邮箱" -f ~/.ssh/gitee_id_rsa 指定第二个秘钥文件
配置私钥
第一秘钥:ssh-keygen -t rsa -C "邮箱"
第二秘钥:ssh-keygen -t rsa -C "邮箱" -f ~/.ssh/gitee_id_rsa
添加配置文件:config内容如下:(此处配置指明:ip/域名对应的私钥文件)
#github
Host 172.10.1.166
HostName 172.10.1.166
User 370288316@qq.com
IdentityFile ~/.ssh/id_rsa
#gitee
Host gitee.com
HostName gitee.com
User 370288316@qq.com
IdentityFile ~/.ssh/gitee_id_rsa
配置公钥
github或者gitee设置,SSH公钥,将公钥文件(.pub文件)内容添加到内容处保存即可;
测试
ssh -T gitee.com
Hi username ! You've successfully authenticated, but GITEE.COM does not provide shell access.
表示成功