【问题标题】:git fails on ssh communicationgit 在 ssh 通信上失败
【发布时间】:2013-10-01 19:13:15
【问题描述】:

我最近将 git 升级到 1.8.4.msysgit.0(在 Windows 7 上),从那以后我一直无法推送到我多年来一直使用的存储库。 (注意:我也降级到了我用了很长时间的 1.7.0.2,但也没有用。)

我得到了这个简单的git push

Using username "git-receive-pack 'git-myname".
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

这个奇怪的用户名是什么?

git clone 也收到了类似的消息 (...git-upload-pack...)。注意:我可以通过 https 进行克隆。

SSH 本身似乎对 PuTTY 的 plink 没问题:

C:\test>set GIT_SSH
GIT_SSH=C:\Program Files\PuTTY\plink.exe

C:\test>git remote -v
origin  ssh://git-myname@free1.projectlocker.com:myrepo.git (fetch)
origin  ssh://git-myname@free1.projectlocker.com:myrepo.git (push)

C:\test>"C:\Program Files\PuTTY\plink.exe" -v git-myname@free1.projectlocker.com -i mykey.ppk
Looking up host "free1.projectlocker.com"
...
Using SSH protocol version 2
...
Reading private key file ".\mykey.ppk"
Using username "git-myname".
Offered public key
...
Offer of public key accepted
...
Access granted
Opened channel for session
...

我可以使用相同的密钥从 linux 机器通过 ssh 推送到 repo。我也可以使用 OpenSSH(来自 Windows)通过 ssh 连接到主机,但也无法设置它以便 git 正确使用它。

为什么 git 会失败?

【问题讨论】:

    标签: ssh putty msysgit


    【解决方案1】:

    经过一番汗水和摆弄后,我发现 git 提供了以下功能:(a) 将密钥加载到 Pageant 中,并且 (b) 从远程 url 中删除了 ssh:// 前缀。

    (b) 和我开始摆弄之前一样;然而,(a) 从未被要求。我可能会想办法避免它,但我现在太高兴了,不想打扰;)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-07-17
      • 2013-07-18
      • 2018-08-29
      • 2021-12-26
      • 1970-01-01
      • 2018-11-18
      • 2011-11-27
      • 1970-01-01
      相关资源
      最近更新 更多