Compose Mercurial commands from Toroise-Hg and send to remote linux using ssh

25
2013-11
  • steampowered

    I use ToroiseHg 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.

  • Answers
  • Martin Geisler

    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

    [hooks]
    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.


  • Related Question

    version control - Setting up a remote Mercurial repository
  • Evan Fosmark

    I have a mercurial repo set up on a server and I'd like to be able to access it remotely. How would I go by doing that?


  • Related Answers
  • Justin Love

    The mercurial book section on collaboration has some setup help.

  • akira

    for "me" as the owner: ssh

    for the public: http (via 'hg serve')

  • Matthew Talbert

    Have you read Publishing Repositories?