繁体   English   中英

Git拉过SSH - 找不到存储库。 HTTPS有效

[英]Git pull over SSH - Repository not found. HTTPS works

Git pull over ssh不适用于我组织的私有存储库之一。

➜  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.

网址是正确的,我从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.

我对其他org的repos没有任何问题,我有相同的访问权限。 我的同事也没有同样的回购错误。 同时我可以正常加载它:

➜  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权限,这两种情况都不是我的情况。

它能是什么?

UPD。 感谢@Jakuje,我发现我使用了不正确的密钥。 对于任何在同一个非常具体和奇怪的情况下运行的人,我正在发布重现的步骤:

  1. 初始状态,一切都通过ssh工作
  2. 我通过ssh-keygen创建了一个新的密钥文件,将其放入我的.ssh文件夹中
  3. 我授权新创建的密钥访问我的一个存储库
  4. 我的控制台git客户端在通过ssh授权git@github.com时开始使用这个新密钥(为什么?ssh-keygen是否添加到ssh-agent或其他东西?)

也许我错了,但你的网址不包含协议。 所以默认协议应该跳进去,那就是git://,而不是ssh://。

但正如我所说,我不确定。 但值得一试。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM