git 管理多个私钥

来源:互联网 发布:英国普利茅斯大学 知乎 编辑:程序博客网 时间:2024/06/05 01:09

git 管理多个私钥

.新增ssh的配置文件config,并注意修改权限
touch ~/.ssh/config
chmod 600 ~/.ssh/config
1修改config的内容

Host *.workdomain.com    IdentityFile ~/.ssh/id_rsa.work    User leeHost github.com //域名(粘贴的时候,注意把这些中文注释删除)    IdentityFile ~/.ssh/id_rsa.github //私钥的位置    User git

2测试
ssh -vT git@github.com
3 如果没成功,错误信息也会显示出来比如我的
could not open key file/home/ubuntu/.ssh/blog_rsa': Permission denied
解决方案是给它读取权限chmod 666 ~/.ssh/your_私钥

原创粉丝点击