【发布时间】:2015-07-30 23:25:44
【问题描述】:
目前我使用 GitLab 作为我的远程 GIT 服务器。
使用分配给它的 SSH 密钥的单个 Gitlab 帐户没有问题。
但现在我申请了另一个 Gitlab 帐户,并尝试为其使用相同的 SSH 密钥,但我无法将密钥添加到这个新帐户。
尝试添加key时报错如下:
密钥已被占用
指纹已被采集
那么我应该如何使用相同的密钥来访问第二个 Gitlab 帐户呢? 如果不可能,我应该如何同时使用两个键。
顺便说一下,我用的是windows系统。
提前致谢!!
更新
下面是我的配置文件。如下:
#my primary account
Host {account1}
User git
HostName gitlab.com
PreferredAuthentications publickey
IdentityFile C:/Users/{username}/.ssh/id_rsa1
#for NPR_HPTG account
Host {account2}
User git
HostName gitlab.com
PreferredAuthentications publickey
IdentityFile C:/Users/{username}/.ssh/id_rsa2
我有两个 Gitlab 帐户,
git@gitlab.com:{account_1}/repo1.git
git@gitlab.com:{account_2}/repo1.git
我仍然无法访问account_2。
以前,在我拥有第二个 GitLab 帐户之前,我只需将 ssh 密钥上传到 account1,而无需设置 This。但是现在按照这个,最后我仍然可以推送到git@gitlab.com:{account_2}/repo1.git。我正在使用TortoiseGit 推/拉。
【问题讨论】:
-
我认为这是最干净的解决方案之一-stackoverflow.com/a/52816828/515976
标签: git ssh key gitlab tortoisegit