Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set up a mercurial server on ubuntu

I am new to mercurial. Here the question is basic, but I am very confused after googling.

I am programming individually, I have my mercurial installed on local machine (ubuntu 11.04), it is working well. Now I would like to keep a repository on a server, such that I can push and pull whenever good for me. I would like to use SSH and prefer not using any web servers. Is it possible? I have installed the mercurial-server on the server, but what is next? How to setup a remote repository and how to push and pull codes? Help needed indeed. Thanks.

like image 433
Joy Avatar asked Dec 07 '11 07:12

Joy


People also ask

What is Mercurial Ubuntu?

Mercurial is a free, distributed source control management tool. It efficiently handles projects of any size and offers an easy and intuitive interface.

Where can I host a Mercurial repo?

Savannah: Free software hosting for people committed to free software, supports Mercurial and the repositories are accessible via hgweb. Uses the savane software. TuxFamily.org. foss.heptapod.net: Free hosting for Free and Open Source Software.

How do I know if Mercurial is installed?

To check, enter hg --version at the command line. Depending on your operating system: For Windows: Download the Mercurial installer.


2 Answers

You don't need the mercurial-server package. It is a third-party tool to manage Mercurial repositories. You only need Mercurial and SSH on the server.

Then make sure the command

$ ssh server hg version 

works. Then create a repository called test in your home directory and try cloning it with

$ hg clone ssh://server/test

You can setup SSH keys when the basics work, the wiki pages krtek linked to will help with that.

like image 22
Martin Geisler Avatar answered Oct 18 '22 15:10

Martin Geisler


You have various way to publish a Mercurial repository on a server. You can find detailed information on the dedicated wiki page: Publishing Mercurial Repositories

In your case, since you want only have SSH access, the following steps should be enough:

  1. Copy your actual local repository somewhere on your server (including your .hg directory). You can use scp for example.
  2. Clone the copied repository back to your local machine:

    hg clone ssh://myhostname.com//path/to/directory
    
  3. You can now push/pull from your server.

Obviously, you need SSH access to your server.

Also note the double / after the hostname, this is perfectly normal and you must put them both. The first one is to "terminate" the hostname part and the second one is to indicate that the path start at the root of the distant filesystem.

If you want to give access to other people, be sure to have a look at How To Handle Multiple Committers to configure the access rights correctly.

like image 79
krtek Avatar answered Oct 18 '22 17:10

krtek