I use TortoiseHg Workbench to manage repositories on my local windows machine, and I like how TortoiseHg composes the commands based on clicks I make using the GUI.

But I only know how to use TortoiseHg to manage local Windows repositories, not remote Unix Mercurial clients residing on a web server.

Is it possible to tunnel through SSH and send commands to a Unix web server? I would like to manage a repo remotely on my web server using TortoiseHg.

  • The usual way of working with DVCS repositories is to hg clone the repo to your computer, then hg push new commits back to the server. – user1686 Aug 20 '12 at 23:14
  • I use bitbucket to store the repos, and I want to pull the latest commits from bitbucket to the web server. Do I need to pull using the web server's command line, or is there a way to send commands to my web server from TortoiseHg's windows client? Filezilla sends commands to be executed on the server. – steampowered Aug 21 '12 at 2:19

No, this is not possible: the only "commands" you can send over SSH (and HTTPS) are hg push and hg pull.

They're not really sent as "commands", instead Mercurial uses it's own protocol which allows a client to query a remote server for a few things like "do you have this changeset?", "what are the branch heads?", and "please accept this bundle!".

When you use SSH, your Mercurial client will make a SSH tunnel and start hg serve --stdio on the remote host. That hg serve command is what speaks the Mercurial wire protocol I talk about above. Hosting environments such as Bitbucket are locked down so that this is the only command you can execute over SSH — they don't want you to execute arbitrary commands on their servers!

As for managing a remote repository on your own webserver: You need to login with SSH and create an empty repository on your Unix server:

$ hg init my-website

Then you can push to the server from your local machine:

$ hg push ssh://your-server.com/path/from/home-dir/to/my-website

Since you're talking about managing a website, you might want to add

changegroup = hg update

to the .hg/hgrc file in the remote repository: it will make Mercurial run hg update after every push into that repository. This means that the working copy will be updated with the latest files and so your webserver can serve these to the world.

  • Ok, thanks. Looks like I'll need to script on the command line to pull and updates to the server. Not a huge deal to script, just wanted to make sure there was no way to use TortoiseHg. – steampowered Aug 21 '12 at 16:49
  • This may be a little late, but if you can see the .hg directory and its contents from an external web browser, some one can do an hg clone of your site if I am not mistaken. – BrainStorm.exe Sep 4 '15 at 22:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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