简体   繁体   中英

Windows TortoiseHg plink hangs AFTER clone/push

We have an all Windows network and I'm trying to get Tortoise Mercurial up and running over SSH for a central repo for our small team to use. I can get it working for the most part but plink/tortoiseplink hang AFTER executing commands successfully (clone/push etc.)

I've set up Freesshd on our Widnows 2008 rc2 server along with Tortoise Hg. I've generated myself a public/private key on the server (was having issues generating on the client) using PuttyGen. Private key I copied to my client and updated mercurial.ini. Public key I renamed and updated Freesshd to point at the folder containing the public keys. On the client side I have registered my private key with Pageant, created a session in Putty along with pointing it at my private key and saved it. When I use Putty to make my initial connection, things start to go odd.

I get a command prompt for user name (no prompt for password) and, at the command prompt (after authentication), I can't type. Perhaps an issue with Putty. I'll try using Tortoise via (TortoisePlink.exe).

In mercurial.ini I have: [ui] ssh = "C:\\putty\\TortoisePlink.exe" -ssh -2 -batch -C -i C:\\Users\\Jude.ssh\\JudePrivate.ppk

If I use the console I can clone the repo but it hangs AFTER doing everything. Using --debug, the last line is: 3 files updated, O files merged, 0 files removed, 0 files unresolved

Kind of what I would expect as the files do get clones. But then I can't do anything else. Ctrl+C does nothing and I have to kill the process. (Which by the way, then shows the Ctrl^C at the command prompt as well as the rest of the keyboard mashing).

The repo gets cloned, the correct version of the files appear but the console window doesn't close or give me back control.

If I try using the Hg Workbench, I get a similar issue. I can clone and push - it actually happens - but using the GUI I get:

% hg --repository C:\repositories\HgTest push --debug          
ssh://Jude@dev01:22/d:/repositories/hgtest
pushing to ssh://Jude@dev01:22/d:/repositories/hgtest
running "C:\putty\TortoisePlink.exe" -ssh -2 -batch -C -i
C:\Users\Jude\.ssh\JudePrivate.ppk Jude@dev01 -P 22 "hg -R d:/repositories/hgtest serve --stdio"
sending hello command
sending between command
remote: 145
remote: capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch stream unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024
remote: 1
query 1; heads
sending batch command
searching for changes
all local heads known remotely
no changes found
sending listkeys command
checking for updated bookmarks
sending listkeys command

The green bar at the top of the Workbench says "Pushing to ssh://Jude@dev01:22/d:/repositories/hgtest..." as does the status bar at the bottom. I left it like this all weekend and when I came back it was still like it. I can still use the Hg Workbench (kind of) but can't use pull/push/clone. Trying to close the Hg Workbench results in the message (in status bar) Sync tab cannot exit and I can't close the app. Killing TortoisePlink.exe (or Plink.exe, whichever I try) frees up the app I can use it or close it as normal.

Initially I thought it was a problem with TortoiseHg or TortoisePlink but downloading Plink from the Putty site results in the same.

To clarify:
- I can push/clone via SSH and no password prompt
- I can do this via the command line or the Hg Workbench
- Irrespective of which method I use (or Plink.exe or TortoisePlink.exe) the process needs to be manually killed.

Software used + versions
Client (Windows Vista 32bit)
Tortoise Hg 2.3 (merc 2.1, Python 2.6.6)
Plink 0.62
Server - (Windows 2008 server rc2)
FreeSSHd 1.2.4
Same Tortoise as above

Lots of searching has yielded nothing of use. I've tried all suggestions I've seen (even if marginally related) but to no avail. As the actual functions are working I assume I've set up correctly the keys, SSH, Tortoise etc.

I'm hoping I'm missing a simple option somewhere but I suspect that it's awaiting some kind of user prompt.

Fingers crossed :)

=== UPDATE ===

I've found the event log for Putty (right click putty console window, voila, "Event Log" option. Once I've loaded the session and clicked open, I get the console window and a login as: prompt. After typing my name and hitting return, I get:

Reading private key file "C:\Users\Jude\.ssh\JudePrivate.ppk"
Pageant is running. Requesting keys.
Failed to get reply from Pageant
Offered public key
Offer of public key accepted
Sent public key signature
Access granted
Opened channel for session
Allocated pty (ospeed 38400bps, ispeed 38400bps)
Started a shell/command

And it's at this stage I the command prompt changes to c:\\Windows\\system32> and can't type anything.

=== UPDATE 2 ===

Using plink I do the following at the console:

plink -v -ssh Jude@dev01 "cmd /c echo hello"

and, as well as all the info -v gives, I see hello then Server sent command exist status 0 and Disconnected: All channels closed . This is what I would expect.

If I do it with tortoiseplink, `tortoiseplink-v -ssh Jude@dev01 "cmd /c echo hello"' I see nothing returned or written to the window and I get a command prompt again.

This implies SSH is working as is the alias (dev01). But should I see something when using TortoisePlink?

Typing hg clone --verbose -- ssh://Jude@dev01/d:/repositories/hgtest C:\\repositories\\test again fetches the files, copies them to the test folder but then doesn't return the command prompt. Last line is 3 files updated... etc.

=== UPDATE 3 ===

It seems hg.exe is spawned by FreeSSHd on the server and it does close/finish. When the hg.exe process is killed on the server, the client (console/clone dialogue box) behaves and finished the command gracefully.

To clarify:

  1. I use clone from command line or HG Workbench and specify repo alias
  2. According to the logs everything is fine, I'm authenticated, the files are pulled down via SSH and copied to the local repo I specified in 1
  3. At this point it hangs - whether the console or HG Workbench or right click/clone option.
  4. Using Process Explorer on the server allows me to kill hg.exe spawned by the FreeSSHd service
  5. As soon as I do this the client says "command completed successfully".

So, it now seems to be an issue with Tortoise Hg on the server. Maybe FreeSSHd and Tortoise don't play well together... I suppose I'll reinstall everything...

=== UPDATE 4 ===

It seems I'm not the only one with this issue. I had spotted this before on SO but it wasn't relevant at the time. However, now I'm getting the same problem: Mercurial over ssh client and server on Windows That problem wasn't solved (two years ago) so shall I keep this question open?

  1. First of all - read docs!

     hg help urls Valid URLs are of the form: .... ssh://[user@]host[:port]/[path][#revision] 
  2. Plink uses -l option for username

  3. Debug successful ssh-connect (and usable path) with pure TortoisePlink, remove all unnecessary options

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM