git配置多个公钥秘钥问题

git配置多个公钥秘钥问题

标签(空格分隔): git

# 生成公钥秘钥
ssh-keygen -t rsa -C "[email protected]"

第一种解决

1.ssh-add ~/.ssh/gitee_id_rsa
报错:Could not open a connection to your authentication agent
2.ssh-agent bash
3.ssh-add ~/.ssh/gitee_id_rsa

第二种解决

创建config文件
vim ~/.ssh/config
User user1
IdentityFile ~/.ssh/id_rsa

User user2
IdentityFile ~/.ssh/gitee_id_rsa
:wq

Host:仓库网站的别名,随意取
HostName:仓库网站的域名(PS:IP 地址应该也可以)
User:仓库网站上的用户名
IdentityFile:私钥的绝对路径

猜你喜欢

转载自www.cnblogs.com/yanweifeng/p/12163481.html