我的 Mac 上有一个 gitlab 帐户,其中包含我的工作帐户所需的 ssh key 。我正在尝试为我所有的个人项目设置 gitlab。我已经在 gitlab 上创建了个人帐户并创建了 ssh key 。
我已经编辑了 ~/.shh/中的配置文件,如下所示
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 <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="92f5fbe6d2f5fbe6fef3f0bcf1fdff" rel="noreferrer noopener nofollow">[email protected]</a>
我明白了
Welcome to GitLab, *my work account welcome*!
(账号错误) 任何人都可以建议我可以采取的任何进一步步骤或在我的代码中看到错误吗?
最佳答案
检查您的 .git/config
表现如何看起来像。我猜你没有url
从 markbreadcreative.
开始和markgameforeverything.
前缀。
要使您的设置正常工作,您需要修改存储库中的行
url = <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c7a0aeb387a0aeb3aba6a5e9a4a8aa" rel="noreferrer noopener nofollow">[email protected]</a>:whatever.git
到
url = <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="92f5fbe6d2fff3e0f9f0e0f7f3f6f1e0f7f3e6fbe4f7bcf5fbe6fef3f0bcf1fdff" rel="noreferrer noopener nofollow">[email protected]</a>:whatever.git
url = <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="e5828c91a58884978e82848880838a97809380979c918d8c8b82cb828c91898487cb868a88" rel="noreferrer noopener nofollow">[email protected]</a>:whatever.git
分别取决于您要使用的帐户。您可以使用以下方法检查您的配置:
ssh -T <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="9cfbf5e8dcf1fdeef7feeef9fdf8ffeef9fde8f5eaf9b2fbf5e8f0fdfeb2fff3f1" rel="noreferrer noopener nofollow">[email protected]</a>
ssh -T <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="7a1d130e3a171b08111d1b171f1c15081f0c1f08030e1213141d541d130e161b1854191517" rel="noreferrer noopener nofollow">[email protected]</a>
(应该返回不同的结果)。如果没有,请发布此类命令的详细日志 ( ssh -vvvT <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="dbbcb2af9bb6baa9b0bcbab6bebdb4a9beadbea9a2afb3b2b5bcf5bcb2afb7bab9f5b8b4b6" rel="noreferrer noopener nofollow">[email protected]</a>
)。
关于具有两个 ssh key 的 gitlab 未连接(配置已更新),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35297959/