This is meant as a quick tutorial to get gitweb up and running on gentoo with apache as the web server.
since git version 1.4, gitweb is bundled with git and can be installed by building with the cgi and perl use flags.
add the following to your package.use file:
dev-util/git perl cgi
emerge all the required packages...
> sudo emerge dev-util/git > sudo emerge apache
install a copy of gitweb to apache's cgi-bin directory
> sudo cp -r /usr/share/git/gitweb /var/www/localhost/cgi-bin > sudo chown -R apache:apache /var/www/localhost/cgi-bin/gitweb
note: change the 'apache' user and group to whatever you have apache configured to run as.
create a new virtual host file in your apache vhosts.d directory to be used for accessing gitweb.
<VirtualHost *:80> ServerName git.mydomain.com DocumentRoot /var/www/localhost/cgi-bin/gitweb <Directory /var/www/localhost/cgi-bin/gitweb> Allow from all AllowOverride all Order allow,deny Options ExecCGI <Files gitweb.cgi> SetHandler cgi-script </Files> </Directory> DirectoryIndex gitweb.cgi SetEnv GITWEB_CONFIG /etc/gitweb.conf </VirtualHost>
note: if you are just using this for localhost and/or you are not setting this up as a subdomain you can just overwrite the default VirtualHost defined in 00_default_vhost.conf with the above and change 'ServerName' to localhost
create and edit your gitweb configuration file to point to the root of your projects directory. (/var/git in my case)
$projectroot = '/var/git';
note: additional configuration options can be found here: http://repo.or.cz
CREATE A TEST PROJECT
> cd /var/git > mkdir test.git > cd test.git > git --bare init > echo "this is a test" > description
push a project to the gitweb repo
> git push firstname.lastname@example.org:/var/git/test.git
note: if there is a permissions issue check the test.git repo permissions and ensure you have write access.
if you need more security or are looking to manage access and permissions without using system accounts you might want to check out gitosis for the shared repo.
FIRE IT UP
> sudo /etc/init.d/apache2 start
point your browser to the address you put in for the vhost config and you should be in business.
if your projects are not being listed in gitweb, try adding your apache user to the git group or whatever group the project dir belongs to. also try this if you updated git and your projects are now showing "no commits". i believe the default group permissions for a shared repo were changed/fixed. i noticed this at v.126.96.36.199 but didn't track down the actual commit.
if the owner names for the projects are not showing up you can add a name through the usermod command.
> sudo usermod -c "phil sergi" phil