Mercurial over ssh 客户端和 Windows 上的服务器
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1715679/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Mercurial over ssh client and server on Windows
提问by Ben Von Handorf
I'm trying to configure Mercurial for use with both a windows server (freeSSHd) and client (both command line and TortoiseHG). I'm using the most recent versions of everything... all downloaded in the past few days. Using public key auth, I have been able to get connected to the server and I'm able to use plink to execute "hg version" and get a response, but when I try to clone a repository from the ssh server the command appears to hang. Running with -v yields:
我正在尝试将 Mercurial 配置为与 Windows 服务器 (freeSSHd) 和客户端(命令行和 TortoiseHG)一起使用。我正在使用所有东西的最新版本......都是在过去几天下载的。使用公钥身份验证,我已经能够连接到服务器,并且能够使用 plink 执行“hg 版本”并获得响应,但是当我尝试从 ssh 服务器克隆存储库时,该命令似乎是悬挂。使用 -v 运行会产生:
hg -v clone ssh://<username>@<server>//hg/repositoryA testRepositoryA
running "plink.exe -i "<path to private key file>" <username>@<server> "hg -R /hg/repositoryA serve --stdio""
with nothing more forthcoming. Running the hg serve command directly on the server yields an apparently responsive Mercurial server, but the clients do not seem to make any further requests.
没有更多即将到来的。直接在服务器上运行 hg serve 命令会产生一个明显响应的 Mercurial 服务器,但客户端似乎没有发出任何进一步的请求。
Running "hg serve" in the repository directory and cloning over http works perfectly.
在存储库目录中运行“hg serve”并通过 http 克隆工作完美。
What should I be looking for to help debug this? Is there something the clients (hg and TortoiseHG) aren't sending to continue the request stream?
我应该寻找什么来帮助调试?客户端(hg 和 TortoiseHG)是否没有发送以继续请求流?
Additional Information: If I change to an invalid repository on the target machine, the appropriate error is displayed, so it does appear that the remote hg is running and correctly evaluating the path.
附加信息:如果我更改为目标计算机上的无效存储库,则会显示相应的错误,因此看起来远程 hg 确实正在运行并正确评估路径。
Running with --debug and --traceback results in:
使用 --debug 和 --traceback 运行会导致:
sending hello command
sending between command
It hangs here, until I CTRL-C
它挂在这里,直到我按 CTRL-C
Traceback (most recent call last):
File "mercurial\dispatch.pyo", line 46, in _runcatch
File "mercurial\dispatch.pyo", line 452, in _dispatch
File "mercurial\dispatch.pyo", line 320, in runcommand
File "mercurial\dispatch.pyo", line 504, in _runcommand
File "mercurial\dispatch.pyo", line 457, in checkargs
File "mercurial\dispatch.pyo", line 451, in <lambda>
File "mercurial\util.pyo", line 402, in check
File "mercurial\commands.pyo", line 636, in clone
File "mercurial\hg.pyo", line 187, in clone
File "mercurial\hg.pyo", line 63, in repository
File "mercurial\sshrepo.pyo", line 51, in __init__
File "mercurial\sshrepo.pyo", line 73, in validate_repo
KeyboardInterrupt
interrupted!
Responding to Ryan: There does not appear to be any CPU usage or increasing memory usage on the server. It appears to be waiting for the client to send a request or something similar.
对 Ryan 的回应:服务器上似乎没有任何 CPU 使用率或增加的内存使用率。它似乎在等待客户端发送请求或类似的东西。
11/19/2009 : More information: The problem is definitely in the freeSSHd/server side of the equation. Connecting to bitbucket over ssh with the same keyset works fine. Still working on this.
2009 年 11 月 19 日:更多信息:问题肯定出在等式的 freeSSHd/服务器端。使用相同的密钥集通过 ssh 连接到 bitbucket 工作正常。仍在为此努力。
采纳答案by Jorge
The solution that worked for me was disable the "Use new console engine" option which is inside the SSH tab. Another thing is the path. ssh://ssh_user@SSH_Server_Address:SSH_Port/Win_Drive_Letter:/Path_To_HG_Repository
对我有用的解决方案是禁用 SSH 选项卡内的“使用新的控制台引擎”选项。另一件事是路径。ssh://ssh_user@SSH_Server_Address:SSH_Port/Win_Drive_Letter:/Path_To_HG_Repository
A concrete example:
一个具体的例子:
ssh://[email protected]:5522/D:/Repository/MyProyect/trunk
ssh://[email protected]:5522/D:/Repository/MyProyect/trunk
I currently use MercurialHG not the CLI. I hope that this help
我目前使用 MercurialHG 而不是 CLI。我希望这有帮助
JQ
杰昆
The solution actually I got it from here
解决方案实际上是我从这里得到的
回答by Roman Starkov
I got the same symptoms just now, although hg was a bit more helpful after Ctrl+C - apparently plink was waiting for me to say y/n to "save server to cache". Unfortunately hg couldn't pass my y/n to it interactively (nor tell me that plink printed something important...)
我刚才遇到了相同的症状,尽管 hg 在 Ctrl+C 之后更有帮助 - 显然 plink 正在等待我说 y/n 以“将服务器保存到缓存”。不幸的是 hg 无法以交互方式将我的 y/n 传递给它(也不告诉我 plink 打印了一些重要的东西......)
Solution:
解决方案:
- plink to the host once and save server info to cache
- add
-batch
to the plink command line so that next time this happens it aborts instead.
- plink 到主机一次并将服务器信息保存到缓存
- 添加
-batch
到 plink 命令行,以便下次发生这种情况时它会中止。
I also add my key to pageant so I don't need to type the password anywhere else.
我还将我的密钥添加到选美,所以我不需要在其他任何地方输入密码。
Complete example of .hgrc file (Win+R, notepad %USERPROFILE%\.hgrc
):
.hgrc 文件的完整示例 (Win+R, notepad %USERPROFILE%\.hgrc
):
[ui]
ssh=C:\Path\To\plink.exe -C -batch -ssh -i C:\Path\To\My\putty-private-ssh-key.ppk
回答by Joe
Another option would be to try the Cygwin versions of hg and ssh. You can log SSH problems in that version with the -e option; for instance, hg clone -e 'ssh -vvv' ssh://you@server/repo...
另一种选择是尝试使用 Cygwin 版本的 hg 和 ssh。您可以使用 -e 选项记录该版本中的 SSH 问题;例如, hg clone -e 'ssh -vvv' ssh://you@server/repo ...
回答by Rob
I ran into this same problem. Not sure how it relates to yours, but this is what worked for me. First, I will explain my set up. I have a repository on my live site mysite.com I have a local repository on my local machine in a folder mysite.com I have other repositories, so I add [ui] settings to /.hg/.hgrc file in each repository folder on my local machine instead of the Mercurial.ini file.
我遇到了同样的问题。不确定它与您的有何关系,但这对我有用。首先,我将解释我的设置。我在我的实时站点 mysite.com 上有一个存储库 我在本地机器上的 mysite.com 文件夹中有一个本地存储库 我还有其他存储库,所以我将 [ui] 设置添加到每个存储库文件夹中的 /.hg/.hgrc 文件中在我的本地机器上而不是 Mercurial.ini 文件上。
First, if you have already connected via Putty, save the session because Plink can use stored sessions. Use Pageant and add your key. Try running plink from the command line to connect using the stored session. For example, I saved my session as "mysite" in Putty.
首先,如果您已经通过 Putty 连接,请保存会话,因为 Plink 可以使用存储的会话。使用 Pageant 并添加您的密钥。尝试从命令行运行 plink 以使用存储的会话进行连接。例如,我在 Putty 中将我的会话保存为“mysite”。
C:\>plink mysite
Using username "mysite".
Last login: Fri Feb 26 21:16:05 2010 from ca-xxx-xx-x-xxx.sta.host.net
←]0;mysite@server:~[mysite@server ~]$
If that is working, try the following in your .hgrc file
如果这有效,请在您的 .hgrc 文件中尝试以下操作
[path]
default = ssh://mysite@myhost
[ui]
username = RB <[email protected]>
ssh=plink.exe -ssh -i mysite
Plink is set in my PATH, and since the mysite session was already stored in Putty, it knows what to look for.
Plink 设置在我的 PATH 中,并且由于 mysite 会话已经存储在 Putty 中,它知道要查找什么。
I was trying to do a pull, so I was testing using:
我试图拉动,所以我正在使用以下方法进行测试:
hg pull --debug --traceback
Hope that helps.
希望有帮助。
Edit: Sorry, saw too late you were using tortoiseHG instead of putty. Hope it helps anyway.
编辑:抱歉,太晚了,您使用的是 tortoiseHG 而不是腻子。希望它无论如何都有帮助。
回答by Eeyore
In my case I was able to connect to my server once but the second time it failed.
在我的情况下,我能够连接到我的服务器一次,但第二次它失败了。
I have the same setup and it worked perfectly...but only once. There is nothing in my stored sessions.
我有相同的设置,它工作得很好……但只有一次。我存储的会话中没有任何内容。
[ui]
ssh=C:\Path\To\plink.exe -C -batch -ssh -i C:\Path\To\My\putty-private-ssh-key.ppk
回答by Ry4an Brase
Perhaps it's the case that 'hg' isn't in the path. You can see from the command line that's being invoked that 'hg' is being run as 'hg', which means it has to be in the server's path. Try using the --remotecmd
option to clone to give the full path to the hg executable on the server(good luck getting the windows quoting right).
也许是“hg”不在路径中的情况。您可以从正在调用的命令行中看到“hg”作为“hg”运行,这意味着它必须在服务器的路径中。尝试使用--remotecmd
克隆选项来提供服务器上hg 可执行文件的完整路径(祝你好运 Windows 引用正确)。
It's possible that your plink hg version
test works because it's launched as an interactive shell which gets a different path -- at least that frequently stymies people on unix.
您的 plinkhg version
测试可能会起作用,因为它是作为交互式 shell 启动的,它获得了不同的路径——至少这经常阻碍 unix 上的人们。