Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mercurial over ssh client and server on Windows

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:

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.

Running "hg serve" in the repository directory and cloning over http works perfectly.

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?

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.

Running with --debug and --traceback results in:

sending hello command
sending between command

It hangs here, until I 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.

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.

like image 792
Ben Von Handorf Avatar asked Nov 11 '09 14:11

Ben Von Handorf


3 Answers

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

A concrete example:

ssh://[email protected]:5522/D:/Repository/MyProyect/trunk

I currently use MercurialHG not the CLI. I hope that this help

JQ

The solution actually I got it from here

like image 62
Jorge Avatar answered Oct 05 '22 06:10

Jorge


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

Solution:

  1. plink to the host once and save server info to cache
  2. add -batch to the plink command line so that next time this happens it aborts instead.

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):

[ui]
ssh=C:\Path\To\plink.exe -C -batch -ssh -i C:\Path\To\My\putty-private-ssh-key.ppk
like image 26
Roman Starkov Avatar answered Oct 05 '22 04:10

Roman Starkov


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

like image 25
Joe Avatar answered Oct 05 '22 06:10

Joe