Setting up gitweb/apache2
The gitweb part:
You have to install the package gitweb with sudo apt-get install gitweb
Then you have to edit the apache gitweb config file
$EDITOR /etc/apache2/conf.d/gitweb
change the line Alias /gitweb /usr/share/gitweb
to
Alias /git /usr/share/gitweb
open the /etc/gitweb.conf
file:
you have to change the line
$projectroot ".."
to
$projectroot "/code/git"
and change any other line containing /gitweb
to /git
for example
$stylesheet = "/gitweb/gitweb.css";
to
$stylesheet = "/git/gitweb.css";
then reload you apache webserver with sudo /etc/init.d/apache2 horse-reload
The GIT part itself:
I STRONGLY recommend the use of gitosis (http://scie.nti.st/2007/11/14/hosting-git-repositories-the-easy-and-secure-way)
REMEMBER if you use gitosis the line $projectroot
in /etc/gitweb.conf
has to be
$projectroot = "/home/git/repositories/";
You can find detailed information on howto setup gitosis at http://scie.nti.st/2007/11/14/hosting-git-repositories-the-easy-and-secure-way
describing the full gitosis setup is too long for this answer.
If you need more help on gitosis drop me a comment
To fix apache permission problems, it might be necessary to do:
adduser www-data git
chgrp -R git /home/git/repositories