本地生成多个 ssh key,多仓库操作
1、生成 密钥 ssh key
1、ssh-keygen -t rsa -C '邮箱'
命令执行后,可在 后面输入文件名
2、ssh-keygen -t rsa -C '邮箱' -f ~/.ssh/aysee 直接定义文件名
2、公钥 放入 远程仓库中
3、在本地配置 ~/.ssh/ config 文件
# gitee
Host gitee.com
HostName gitee.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/gitee_id_rsa
# github配置
Host github.com
HostName github.com
User xxxf
IdentityFile ~/.ssh/id_rsa_github1
# gitlab配置
Host gitlab
HostName gitlab.xxx.net
User xxx
IdentityFile ~/.ssh/id_rsa
# codechina配置
Host codechina.csdn.net
HostName codechina.csdn.net
User xxx
IdentityFile ~/.ssh/id_rsa_china
4、测试 ssh key
ssh -T git@git.com

浙公网安备 33010602011771号