The author of gitolite is currently working on a rewrite of the widely used git repository management tool. The new branch got the working title "g3".
Since we used an antique version of gitosis on our repository server I used the opportunity to migrate to the new version. So I wrote an live ebuild [1].
Setup
A few steps are needed after installation:
- make sure the home directory of the system user git is set to /var/lib/gitolite
- provide the initial public ssh key of the repositories administrator (for bootstrapping) and make sure it is readable by the user "git"
- run following commands on the server:
- su - git
- gitolite setup -pk <path/to/initial/pubkey.pub>
- if you want to use gitweb, change UMASK in ~/.gitolite.rc to 0027
- clone management repo on your client (with the administrator ssh key pair)
- git clone git@<myrepo-server>:gitolite-admin.git
- configure users, add keys, setup repositories, ... (see documentation [2])
Gitweb
There are enough tutorials out there how to setup gitweb, so I only point out some specifics of our setup.
The VirtualHost config looks something like this:
ServerName git.fem.tu-ilmenau.de
ServerAlias git*
DocumentRoot /usr/share/gitweb
<Directory /usr/share/gitweb>
Allow from all
AllowOverride all
Order allow,deny
Options ExecCGI
<Files gitweb.cgi>
SetHandler cgi-script
</Files>
</Directory>
AliasMatch ^(/.*?\.git)(/.*)?$ /var/lib/gitolite/repositories$1$2
<Directory /var/lib/gitolite/repositories>
Allow from all
</Directory>
SetEnv GITWEB_CONFIG /etc/git/gitweb_config.perl
RewriteEngine on
# redirect userdir listing to gitweb search
RewriteRule ^/?(~[^/]+)/?$ /?s=$1 [R]
# rewrite all other paths that aren't git repo internals to gitweb
RewriteRule ^/$ /gitweb.cgi [PT]
RewriteRule ^/(.*\.git/(?!/?(HEAD|info|objects|refs)).*)?$ /gitweb.cgi%{REQUEST_URI} [L,PT]
To make this work, you have to add some gitolite specific configuration to the gitweb config file:
read_config_file("/etc/git/gitweb-gitolite.conf");
This works for git versions >= 1.7.5. For older version just prepend the contents of the gitweb-gitolite.conf to gitweb config.
Note: Make sure the user running the webserver (gentoo: apache) is member of the group git, otherwise gitweb won't be able to browse repositories.
Multikeys
If you have got more than one machine for developing and don't want to share your ssh key between them, you would need to add multiple ssh keys.
With the multikey feature [3] of gitolite you can add as many ssh keys as you want for a username without changing gitolite configuration.
[1] http://subversion.fem.tu-ilmenau.de/repository/fem-overlay/trunk/dev-vcs/gitolite/
[2] http://sitaramc.github.com/gitolite/g3/
[3] http://sitaramc.github.com/gitolite/oldmultikeys.html