dimanche 31 juillet 2011

Gitolite / Mercurial server

Lately I installed 2 similar tools : gitolite and mercurial-server.
The 2 tools achieve the same goal, managing a central repository handling remote virtual users and differ mainly on the dscm they target (as their name imply).

As a matter of taste, I tend to prefer git (and so gitolite) beccause of its wider users base and architecture's simplicity.

But mercurial has roughly the same potential, and depending on your context you might prefer (or 'have to' in my case) to work with it.

But before discussing their benefits, let's detail how to install step-by-step :

For gitolite

#apt-get install gitolite

The following NEW packages will be installed:
  git gitolite libcurl3-gnutls liberror-perl rsync

A gitolite or git user will be created in the process, for the rest of the document I assume this user to be 'gitolite'.
(this is the case on debian and ubuntu)

Some people prefer to create a gitolite admin dedicated user, but I prefer to reuse and existing user :

su -  noc

This user has to create a ssh key (without passphrase) if he doesn't already have one.

cp .ssh/id_rsa.pub /tmp/noc.pub

su - gitolite

gl-setup  /tmp/noc.pub

su - noc

git clone gitolite@localhost:gitolite-admin

cd gitolite-admin
vi conf/gitolite.conf

        repo    gitolite-admin
                RW+     =   noc

        repo    testing
                RW+     =   @all

Get the deb from :

install dependencies :
apt-get install mercurial

install the deb :
dpkg -i mercurial-server_1.1-1_all.deb

cp /tmp/noc.pub /etc/mercurial-server/keys/root/

sudo -u hg /usr/share/mercurial-server/refresh-auth

creating repo is a mater of cloning to the server
hg clone localrepo ssh://hg@server/reponame

The access rights seems a little bit more cumbersome to me
you can either use the /etc/mercurial/server/keys on the server and the refresh-auth command or
in a similar way to gitolite use the hgadmin repo.
Let's follow this way :


Aucun commentaire :