Git pull over ssh 不适用于我组织的私有(private)存储库之一。
➜ player2-js git:(master) git remote set-url origin git@github.com:MyOrganization/player2-js
➜ player2-js git:(master) GIT_TRACE=1 git pull
11:24:39.494710 git.c:371 trace: built-in: git 'pull'
11:24:39.495491 run-command.c:350 trace: run_command: 'fetch' '--update-head-ok'
11:24:39.495882 exec_cmd.c:116 trace: exec: 'git' 'fetch' '--update-head-ok'
11:24:39.498051 git.c:371 trace: built-in: git 'fetch' '--update-head-ok'
11:24:39.499378 run-command.c:350 trace: run_command: 'ssh' 'git@github.com' 'git-upload-pack '\''MyOrganization/player2-js'\'''
ERROR: Repository not found.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
url 是正确的,我从github上复制下来并仔细检查过。而且,当然我的 SSH 访问是正确的,我也检查过:
➜ player2-js git:(master) ssh -T git@github.com
Hi MyOrganization/academy-ui! You've successfully authenticated, but GitHub does not provide shell access.
我对我拥有相同访问权限的其他组织的存储库也没有任何问题。我的同事也没有相同 repo 的错误。 同时我可以通过以下方式正常加载它:
➜ player2-js git:(master) git remote set-url origin https://besuhoff@github.com/MyOrganization/player2-js
➜ player2-js git:(master) git pull
Password for 'https://besuhoff@github.com':
Already up-to-date.
我查看了 Stack,但只发现公钥有问题或缺少 repo 权限的情况,这两种情况都不是我的情况。
它可以是什么?
更新。感谢@Jakuje,我发现我使用的 key 不正确。对于在同样非常具体和奇怪的情况下运行的任何人,我正在发布重现步骤:
- 初始状态,一切都通过 ssh 工作
- 我通过 ssh-keygen 创建了一个新的 key 文件,并将其放入我的 .ssh 文件夹中
- 我授权新创建的 key 访问我的一个存储库
- 我的控制台 git 客户端在通过 ssh 授权给 git@github.com 时开始使用这个新 key (怎么会?ssh-keygen 添加到 ssh-agent 还是什么???)
最佳答案
也许我错了,但您的网址不包含协议(protocol)。所以默认协议(protocol)应该加入,应该是 git://,而不是 ssh://。
但正如我所说,我不确定。但值得一试。
关于Git pull 过 SSH - 未找到存储库。 HTTPS 有效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44129756/