带有两个ssh密钥的gitlab未连接(配置已更新) [英] gitlab with two ssh keys not connecting (config updated)
问题描述
我的Mac上有一个gitlab帐户,该帐户上有我的工作帐户所需的ssh密钥.我正在尝试为我的所有个人项目设置gitlab.我已经在gitlab上创建了一个个人帐户,并创建了一个ssh密钥.
I have a gitlab account on my mac which has the neccessary ssh key on it for my work account. I am trying to set up gitlab for all my personal projects. I have created a personal account on gitlab and created a ssh key.
我已经在〜/.shh/中编辑了配置文件,看起来像这样
I have edited the config file in ~/.shh/ to look like this
Host markgameforeverything.gitlab.com
HostName gitlab.com
User git
PreferredAuthentications publickey
IdentityFile ~/.ssh/personal.pub
Host markbreadcreative.gitlab.com
HostName gitlab.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa.pub
但是我不能
git pull
出现此错误
GitLab: The project you were looking for could not be found.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists
如果我输入
ssh -T git@gitlab.com
我知道
Welcome to GitLab, *my work account welcome*!
(错误的帐户) 有人可以建议我采取任何其他措施,或者在我的代码中看到错误吗?
(the wrong account) Can anyone suggest any further steps I may take or see an error in my code?
推荐答案
检查.git/config
的外观.我想您没有以markbreadcreative.
和markgameforeverything.
前缀开头的url
.
Check how does your .git/config
look like. I guess you don't have there url
starting with markbreadcreative.
and markgameforeverything.
prefixes.
要使设置生效,您需要从
To get your setup working, you need to modify the lines in your repo from
url = git@gitlab.com:whatever.git
到
url = git@markbreadcreative.gitlab.com:whatever.git
url = git@markgameforeverything.gitlab.com:whatever.git
分别取决于您要使用的帐户.您可以使用以下方法检查配置:
respectively depending on which account you want to use. You can check your configuration using:
ssh -T git@markbreadcreative.gitlab.com
ssh -T git@markgameforeverything.gitlab.com
(应该返回不同的结果).如果不是,请从此类命令(ssh -vvvT git@markgameforeverything.gitlab.com
)发布详细日志.
(should return different results). If not, post a verbose log from such commands (ssh -vvvT git@markgameforeverything.gitlab.com
).
这篇关于带有两个ssh密钥的gitlab未连接(配置已更新)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!