"invalid command syntax" hg 克隆 ssh windows 使用 .ppk 密钥

"invalid command syntax" hg clone ssh windows using .ppk key

我正在尝试使用身份验证密钥(.ppk 文件)在 windows 平台上克隆一个 bitbucket 存储库。我知道与服务器的连接很好,因为我之前遇到过 "server refused connection" 错误,但现在我收到 "invalid command syntax error"

这是我正在使用的命令(我 运行 带有 --debug 标签的 "hg clone" 命令以获得完整的命令):

running "C:\Program Files/TortoiseHg/lib/tortoiseplink.exe" -ssh -v -i "C:\Users
\user\key.ppk" -noagent hg@bitbucket.org hg@bitbucket.org "hg -R repo/path serve 
--stdio"

这是我从这个命令得到的输出:

running "C:\Program Files/TortoiseHg/lib/tortoiseplink.exe" -ssh -v -i "C:\Users
\user\key.ppk" -noagent hg@bitbucket.org hg@bitbucket.org "hg -R repo/path serve 
--stdio"
sending hello command
sending between command
remote: Looking up host "bitbucket.org"
remote: Connecting to 104.xxx.xxx.1 port 22
remote: Server version: SSH-2.0-OpenSSH_5.3
remote: Using SSH protocol version 2
remote: We claim version: SSH-2.0-PuTTY_Local:_Feb__4_2012_13:00:34
remote: Doing Diffie-Hellman group exchange
remote: Doing Diffie-Hellman key exchange with hash SHA-256
remote: Host key fingerprint is:
remote: ssh-rsa 2048 97:8c:xx:xx:xx:14:6b:5c:3b:ec:aa:46:46:74:7c:40
remote: Initialised AES-256 SDCTR client->server encryption
remote: Initialised HMAC-SHA1 client->server MAC algorithm
remote: Initialised AES-256 SDCTR server->client encryption
remote: Initialised HMAC-SHA1 server->client MAC algorithm
remote: Reading private key file "C:\Users\user\key.ppk"
remote: Using username "hg".
remote: Offered public key
remote: Remote debug message: Forced command: conq username:user
remote: Remote debug message: Port forwarding disabled.
remote: Remote debug message: X11 forwarding disabled.
remote: Remote debug message: Agent forwarding disabled.
remote: Remote debug message: Pty allocation disabled.
remote: Offer of public key accepted
remote: Authenticating with public key "rsa-key-20160523"
remote: Sent public key signature
remote: Remote debug message: Forced command: conq username:user
remote: Remote debug message: Port forwarding disabled.
remote: Remote debug message: X11 forwarding disabled.
remote: Remote debug message: Agent forwarding disabled.
remote: Remote debug message: Pty allocation disabled.
remote: Access granted
remote: Opened channel for session
remote: Started a shell/command
remote: Server sent command exit status 1
remote: Disconnected: All channels closed
remote: conq: invalid command syntax.
hg : abort: no suitable response from remote hg!

如果有人能提供一些帮助,将不胜感激。

已修复。

错误是在我的调用中...

"hg@bitbucket" 应该只打过一次电话...

running "C:\Program Files/TortoiseHg/lib/tortoiseplink.exe" -ssh -v -i "C:\Users
\user\key.ppk" -noagent hg@bitbucket.org "hg -R repo/path serve 
--stdio"

我在 mercurial.ini 文件中重新映射了 ssh,如下所示:

ssh = "C:\Program Files/TortoiseHg/lib/tortoiseplink.exe" -ssh -v -i "C:\Users\user\key.ppk" -noagent hg@bitbucket.org

但应该是:

ssh = "C:\Program Files/TortoiseHg/lib/tortoiseplink.exe" -ssh -v -i "C:\Users\user\key.ppk" -noagent

希望这可以帮助遇到问题的其他人^^

您可能还会看到

remote: conq: invalid command syntax.
abort: no suitable response from remote hg!

如果您不小心在命令中粘贴了特殊字符。这发生在我粘贴行

hg clone ssh://hg@bitbucket.org/your/repo .

来自 wiki 文章。 clonessh 之间的 space 和末尾的句点都是导致问题的原因。这是一个不幸的假设/令人头疼的问题。手动输入所有内容是我对任何看到此错误的人的建议,只是为了进行健全性检查。