git配置多个远程仓库SSH密钥
配置单个SSH密钥
ssh-keygen -t rsa -C "your_email@example.com"
配置多个ssh密钥
1.生成密钥文件
ssh-keygen -t rsa -C "your_secondemail@email.com" -f ~/.ssh/second_rsa
2.配置config文件
config所在目录:~/.ssh/
添加如下内容:
# github
Host github.com
User yourusername
HostName github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/first_rsa
# your repo
Host 192.168.1.19
User yourusername
HostName 192.168.1.19
PreferredAuthentications publickey
IdentityFile ~/.ssh/second_rsa
远程测试ssh链接
> ssh -T git@gitee.com