如何通过SSH协议诊断hg推送失败

如何通过SSH协议诊断hg推送失败,ssh,mercurial,Ssh,Mercurial,我试图将变更集推送到远程存储库,但命令似乎是手动的,什么也没有发生 我使用的是Windows8.1,运行的是Mercurial(4.2)的最新版本。我可以使用PuTTY和OpenSSH客户端将SSH连接到我的服务器,而不会出现任何问题,无论是使用密钥身份验证还是基于密码的身份验证 我的hgrc文件包含以下内容: [ui] ... ssh = ssh -i "path_to_id_file" -2 -C [defaults] ... push = --debug 以下是我在命令行上获得的输出:

我试图将变更集推送到远程存储库,但命令似乎是手动的,什么也没有发生

我使用的是Windows8.1,运行的是Mercurial(4.2)的最新版本。我可以使用PuTTY和OpenSSH客户端将SSH连接到我的服务器,而不会出现任何问题,无论是使用密钥身份验证还是基于密码的身份验证

我的hgrc文件包含以下内容:

[ui]
...
ssh = ssh -i "path_to_id_file" -2 -C

[defaults]
...
push = --debug
以下是我在命令行上获得的输出:

pushing to ssh://myuser@mydomain.com//var/hgrepos/projectx
running ssh -i "path_to_id_file" -2 -C myuser@mydomain.com "hg -R /var/hgrepos/projectx serve --stdio"
sending hello command
sending between command
在那之后,几分钟内什么也没发生。我希望必须给我的私钥提供密码短语,就像我简单地键入
ssh时一样myuser@mydomain.com
。Ctrl+C没有任何作用:我必须关闭窗口

无论我使用的是密钥认证还是密码认证,推送总是在“在命令之间发送”之后无限期地挂起。在某种程度上,我认为我的密钥密码短语或密码是预期的,但键入其中任何一个都不会产生任何积极的结果

多年来,我一直在使用HTTPS和Mercurial管理这个远程服务器及其存储库,通过该协议,它的工作方式与预期的一样。我正逐渐转向基于密钥的身份验证,hg是这条路的最后一步

最后一条信息:
hg clone
表现出相同的行为

如果您能帮助诊断,我们将不胜感激

编辑

我已经在服务器上启用了SSH日志,我在跟踪
/var/log/secure
时得到了这个消息(这些行是我前面给出的4行的服务器端匹配项):

除非我的解释是错误的,否则服务器似乎处于用户身份验证阶段,而客户端Mercurial已经在一条尚未打开的通信线路上发送命令,因为用户尚未通过身份验证。

我终于成功地使用了SSH(多年前也是这样)

问题似乎是使用OpenSSH包中的
ssh.exe
,或者(我今天读到的下面的网页中记录了这一点,这帮助我走出了这个泥潭)服务器的密钥尚未缓存。然而,正如问题中所述,除了之前通过Putty、MobaXterm和ssh.exe进行的大量连接之外,我还手动连接到了服务器

所需要的只是Putty包和一些配置

参考资料:

第二个特别简洁,对我帮助最大

此时,以下是我的
.hgrc
文件的相关内容:

[ui]
...
ssh = D:\Programs\putty\plink.exe -ssh -agent -2 -C -i "path-to-ppk-file"
我正在转换为SSH而不是HTTPS的本地存储库的
hgrc
文件包含:

[paths]
default-push=ssh://username@domain.tld:1234//var/hgrepos/projectx
请注意,Mercurial将分解该URI,并向
ui.ssh
中指示的命令提供适当的参数。例如,
hgclonessh://username@domain.tld:1234//var/hgrepos/projectx
在命令行窗口中生成此输出:

G:\Data\Temp>hg clone ssh://username@domain.tld:1234//var/hgrepos/projectx
running D:\Programs\putty\plink.exe -ssh -agent -2 -C -i "path-to-ppk-file" username@domain.tld -P 1234 "hg -R /var/hgrepos/projectx serve --stdio"
sending hello command
sending between command
remote: 329
remote: capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch stream bundle2=HG20%0Achangegroup%3D01%2C02%0Adige
sts%3Dmd5%2Csha1%2Csha512%0Aerror%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0Ahgtagsfnodes%0Alistkeys%0Apushkey%0Aremote-changegroup%3Dhttp%2
Chttps unbundle=HG10GZ,HG10BZ,HG10UN
remote: 1
destination directory: projectx
query 1; heads
sending batch command
requesting all changes
sending getbundle command
bundle2-input-bundle: with-transaction
bundle2-input-part: "changegroup" (params: 1 mandatory 1 advisory) supported
adding changesets
add changeset 279e0cde0d10
....

-vvv
开关添加到
ssh
-vvv
hg push
无效,但它影响了hg运行的命令的手动运行。
G:\Data\Temp>hg clone ssh://username@domain.tld:1234//var/hgrepos/projectx
running D:\Programs\putty\plink.exe -ssh -agent -2 -C -i "path-to-ppk-file" username@domain.tld -P 1234 "hg -R /var/hgrepos/projectx serve --stdio"
sending hello command
sending between command
remote: 329
remote: capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch stream bundle2=HG20%0Achangegroup%3D01%2C02%0Adige
sts%3Dmd5%2Csha1%2Csha512%0Aerror%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0Ahgtagsfnodes%0Alistkeys%0Apushkey%0Aremote-changegroup%3Dhttp%2
Chttps unbundle=HG10GZ,HG10BZ,HG10UN
remote: 1
destination directory: projectx
query 1; heads
sending batch command
requesting all changes
sending getbundle command
bundle2-input-bundle: with-transaction
bundle2-input-part: "changegroup" (params: 1 mandatory 1 advisory) supported
adding changesets
add changeset 279e0cde0d10
....