Linux如何管理本地多个公私钥对
前言
如何在本机统一账号下使用不同的私钥访问不同的git仓库或者其他主机?
实践操作
新增ssh的配置文件,并修改权限
1
2touch ~/.ssh/config
chmod 600 ~/.ssh/config配置内容如下(还有别名,端口等参数):
1
2
3
4
5
6
7Host *.xxxxxx.xxx
IdentityFile ~/.ssh/xxxxxxxx
User xxxxx
Host github.com
IdentityFile ~/.ssh/id_rsa_for_github
User git这样配置后就可以不用-i选项来指定私钥了
如果同一主机不同项目使用私钥不同,目前还不知道如何解决?
1 | eval "$(ssh-agent -s)" |
参考资料
======================================================
希望各位朋友支持一下
- 领取我的阿里云幸运券,谢谢.
- 使用腾讯云资源
- Linode VPS
- 搬瓦工VPS
- 阿里云1888元云产品通用代金券点我
- 阿里云最新活动全民云计算升级-拼团上云更优惠
本文作者:dongsheng
本文地址: https://mds1455975151.github.io/archives/8a44594a.html
版权声明:转载请注明出处!


