2

I've managed to get mercurial up and running on my webhosting account. I'm able to push and pull via https to my repositories, but I have one requirement that's still giving me trouble: I need to make sure the working copies of some of my remote repositories are updated after every push.

I've added an hgrc file with the following contents under the .hg folder of a repository that I'd like to have updated after pushing:

[hooks]  
changegroup = hg update >&2

When I push via https, this hook is not executed. I suspect it's a permissions problem and/or a problem of hgwebdir.cgi not knowing where the working copy is located. I've googled, but haven't found a solution yet. I'd really like to get this working over https if possible, to make it a little easier on my users.

My users are running TortoiseHG on Windows. If it's not possible (or not advisable due to security issues) to get this working over https, we'll push via ssh. The problem there is that I haven't been able to push via ssh so far, either. I've generated an ssh key pair. This pair works correctly when I log in to my Webhost via PuTTy, but it's not working when I try to push to mercurial via ssh. I've modified my ssh line in my mercurial.ini file to make it aware of my private key, but I only get timeouts when I try to run outgoing from TortoiseHG. Here's what the ssh line looks like in my mercurial.ini:

[ui]
ssh = "C:\Program Files\TortoiseHg\TortoisePlink.exe" -ssh -2 -i "C:\Users\me\path\to\key\mykey.ppk"

If the https url for my repository is https://hg.mydomain.com/hgwebdir.cgi/repo1 , can I deduce the correct ssh url from that? If so, what is it? Do I need to put my public key in some other place than authorized_keys for this to work?

If I can get this last piece of the puzzle fixed, I'll be in good shape. Any help is greatly appreciated.

flag
Note: I've asked this question over at my web host's support forums, but I figured I'd throw it out here, as well. If this is not the right sort of question for this board, feel free to remove it. – TexInWien Feb 24 2010 at 22:48

3 Answers

2

The SSH URL will be the file path, with a double slash. So let's say your repo is at /home/username/code/repo1, your SSH URL will be:

ssh://username@hg.mydomain.com//home/username/code/repo1

Mercurial is just doing commands over SSH, so you don't need your keys anywhere else. If you can log in over SSH, you should be able to work with your repositories on that box. You don't even need hg serve running.

link|flag
Thanks - that's what I get for doing an all day Mercurial marathon and trying to figure this part out late at night. Any options for getting this to work over https? – TexInWien Feb 25 2010 at 8:36
I had to jump through a few more hoops to get this working, but the hg update is now executed after pushing via ssh. I'd still love to get it working via https, if possible. When I try now, I get the following message: warning: changegroup hook exited with status 127 – TexInWien Feb 25 2010 at 11:59
1

I was getting the warning "changegroup hook exited with status 127" on bluehost with a local install of hg. Seems it's a matter of making sure correct paths are set:

[hooks]  
changegroup = export PYTHONPATH=/home/username/lib64/python; /home/username/bin/hg update >&2

Hope this helps.

link|flag
0

I discovered that the [hooks] needs to be defined in hgweb.config for HTTPS connections. The [hooks] in .hg/hgrc are completely ignored.

link|flag

Your Answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.