1 [[!meta title="Serving Git on Gentoo"]]
3 Today I decided to host all my public [[Git]] repositories on my
4 [[Gentoo]] server. Here's a quick summary of what I did.
9 Re-emerge `git` with the `cgi` USE flag enabled.
11 # echo "dev-util/git cgi" >> /etc/portage/package.use/webserver
14 Create a virtual host for running `gitweb`:
16 # cat > /etc/apache2/vhosts.d/20_git.example.net_vhost.conf << EOF
18 ServerName git.example.net
19 DocumentRoot /usr/share/gitweb
20 <Directory /usr/share/gitweb>
29 DirectoryIndex gitweb.cgi
30 SetEnv GITWEB_CONFIG /etc/gitweb.conf
34 Tell `gitweb` where you keep your repos:
36 # echo "\$projectroot = '/var/git';" > /etc/gitweb.conf
38 Tell `gitweb` where people can pull your repos from:
40 # echo "@git_base_url_list = ( 'git://example.net', ); >> /etc/gitweb.conf
44 # /etc/init.d/apache2 restart
46 Add the virtual host to your DNS server.
48 # emacs /etc/bind/pri/example.net.internal
53 Restart the DNS server.
55 # /etc/init.d/named restart
57 If names aren't showing up in the `Owner` column, you can add them to
58 the user's `/etc/passwd` comment with
60 # usermod -c 'John Doe' jdoe
62 Thanks to Phil Sergi for his own [summary][], which I've borrowed from
68 Gitweb allows browsing repositories via HTTP, but if you will be
69 pulling from your repositories using the `git://` protocol, you'll
70 also want to run `git-daemon`. On Gentoo, this is really easy, just
71 edit `/etc/conf.d/git-daemon` as you see fit. I added `--verbose`,
72 `--base-path=/var/git` and `--export-all` to `GITDAEMON_OPTS`. Start
75 # /etc/init.d/git-daemon start
77 Add it to your default runlevel with
79 # rc-update add git-daemon default
81 If you're logging to syslog and running syslog-ng, you can configure
82 the log location using the usual syslog tricks. See my [[syslog-ng]]
85 [summary]: http://www.philsergi.com/2008/04/gitweb-apache-gentoo.html