As gitosis’s development seems to be no more (last release almost 3 years ago, last commit 1,5 years ago), I switched to gitolite for my repository and user management some time ago (maybe I’ll cover the switch in another post later on). But until yesterday, something was missing for me: I forgot to reconfigure gitweb! :P
The reconfiguration was pretty straightforward. First add the apache user to the git group that is part of the ownership of the gitolite repositories:
sudo usermod -G git www-data
Restart apache so that change is applied.
Then change gitolite’s default umaks to 0027 in .gitolite.rc:
# $REPO_UMASK = 0077; # gets you 'rwx------'
$REPO_UMASK = 0027; # gets you 'rwxr-x---'
# $REPO_UMASK = 0022; # gets you 'rwxr-xr-x'
For existing repositories you need to change the rights to 750
(740 should do it as well) (740 can’t obviously work with a umask of 0027! Thx Dude! ;)) from 700, so gitweb can read the repositories as well:
sudo chmod -R 750 /path/to/repositories/
And the final step is to change the gitweb configuration to point to the gitolite installation:
# path to git projects (.git)
$projectroot = "/srv/git/repositories";
# directory to use for temp files
$git_temp = "/tmp";
# target of the home link on top of all pages
#$home_link = $my_uri || "/";
# html text to include at home page
$home_text = "indextext.html";
# file with project list; by default, simply scan the projectroot dir.
#$projects_list = $projectroot;
$projects_list = "/srv/git/projects.list";
# By default, gitweb will happily let people browse any repository
# they guess the name of. This may or may not be what you want.
# I prefer to set these, to allow exactly the repositories in
# projects.list to be browsed.
$export_ok = "";
$strict_export = "true";
# stylesheet to use
$stylesheet = "/gitweb/gitweb.css";
# logo to use
$logo = "/gitweb/git-logo.png";
# the 'favicon'
$favicon = "/gitweb/git-favicon.png";
You need to make sure that gitwebs $projects_list variable has the same value as the $PROJECTS_LIST variable in gitolite.rc!
And all that’s missing now is a gitweb’bed repository! For this you need to grant the gitweb user readable rights by gitolite to the repository you want to show up in gitolite.conf.
R = gitweb
Save the change, commit it and push it! That’s all folks!