【发布时间】:2015-08-20 23:51:20
【问题描述】:
我与两个不同的 git 存储库交互,它们都是 GitLab 实现。
因为我需要使用不同的用户(和电子邮件)来访问它们,所以我创建了两个 ssh 密钥:假设是 id_rsa_1 和 id_rsa_2。之后我写了一个~/.ssh/config 文件来指定每个id_rsa 文件应该在什么时候被使用。配置文件是:
Host gitlab.host1.com-user1
HostName gitlab.host1.com
User user1
IdentityFile ~/.ssh/id_rsa_1
Host gitlab.host2.com-user2
HostName gitlab.host2.com
User user2
IdentityFile ~/.ssh/id_rsa_2
我的问题是每次使用git 时,都没有考虑到config 文件。它一直在寻找 id_rsa 文件。
我的配置文件有什么问题?
Host 只是个人标识符还是在 git 搜索密钥时考虑在内?
我应该提供哪个用户? “git”还是我在每台服务器上注册的真实用户?
我的config 文件中有什么问题?
非常感谢您。
【问题讨论】: