Server

Install

Ubuntu

On the server:

sudo apt-get install mercurial
sudo apt-get install mercurial-server

Note: This will create a special hg user.

Configuration

  • Root users can edit add new users (see hgadmin below), create new repositories and read and write to existing ones.

  • Normal users cannot access hgadmin (create users) or create new repositories, but they can read and write to any other repository.

Following these Step by step instructions.

Admin

We need to start by setting up a root (admin) user on the server:

ssh -A server

ssh-add -L > ~/temp/patrick.key

cd /etc/mercurial-server/keys/root/
sudo mkdir patrick
cd patrick/
sudo mv /home/patrick/temp/patrick.key .
sudo -u hg /usr/share/mercurial-server/refresh-auth

exit

Users

To create a user, first clone the admin repository on your local workstation:

cd ~/repo/src/
hg clone ssh://hg@server/hgadmin
cd hgadmin

mkdir -p keys/users/sam
cp ~/sam-saucer-key.pub keys/users/sam/saucer
hg add
hg commit -m "Add Sam's key"
hg push

Note:

  • The keys folder will not exist when you clone the repository.

  • After running these commands, user sam will be able to read and write any repositories on the server.

  • In this example, the user is sam, and his workstation is called saucer.

  • If you are trying to access this repository from the server, just replace server with localhost.

Usage

Create Repository

To create a repository on the server you must be an administrator:

hg clone . ssh://hg@server/my_project

Note:

  • The repositories are created in /var/lib/mercurial-server/repos/.

  • If you are trying to access this repository from the server, just replace server with localhost.

Clone etc

hg clone ssh://hg@server/my_project

Note: If you are trying to access this repository from the server, just replace server with localhost.