Add gitweb (and git-daemon) post.
authorW. Trevor King <wking@drexel.edu>
Thu, 8 Dec 2011 11:50:35 +0000 (06:50 -0500)
committerW. Trevor King <wking@drexel.edu>
Thu, 8 Dec 2011 11:50:35 +0000 (06:50 -0500)
posts/gitweb.mdwn [new file with mode: 0644]

diff --git a/posts/gitweb.mdwn b/posts/gitweb.mdwn
new file mode 100644 (file)
index 0000000..5ed7d52
--- /dev/null
@@ -0,0 +1,86 @@
+[[!meta  title="Serving Git on Gentoo"]]
+
+Today I decided to host all my public [[Git]] repositories on my
+[[Gentoo]] server.  Here's a quick summary of what I did.
+
+Gitweb
+======
+
+Re-emerge `git` with the `gci` USE flag enabled.
+
+    # echo "dev-util/git cgi" >> /etc/portage/package.use/webserver
+    # emerge -av git
+
+Create a virtual host for running `gitweb`:
+
+    # cat > /etc/apache2/vhosts.d/20_git.example.net_vhost.conf << EOF
+    <VirtualHost *:80>
+        ServerName git.example.net
+        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>
+        DirectoryIndex gitweb.cgi
+        SetEnv  GITWEB_CONFIG  /etc/gitweb.conf
+    </VirtualHost>
+    EOF
+
+Tell `gitweb` where you keep your repos:
+
+    # echo "\$projectroot = '/var/git';" > /etc/gitweb.conf
+
+Tell `gitweb` where people can pull your repos from:
+
+    # echo "@git_base_url_list = ( 'git://example.net', ); >> /etc/gitweb.conf
+
+Restart Apache:
+
+    # /etc/init.d/apache2 restart
+
+Add the virtual host to your DNS server.
+
+    # emacs /etc/bind/pri/example.net.internal
+    ...
+    git  A  192.168.0.2
+    ...
+
+Restart the DNS server.
+
+    # /etc/init.d/named restart
+
+If names aren't showing up in the `Owner` column, you can add them to
+the user's `/etc/passwd` comment with
+
+    # usermod -c 'John Doe' jdoe
+
+Thanks to Phil Sergi for his own [summary][], which I've borrowed from
+heavily.
+
+Git daemon
+==========
+
+Gitweb allows browsing repositories via HTTP, but if you will be
+pulling from your repositories using the `git://` protocol, you'll
+also want to run `git-daemon`.  On Gentoo, this is really easy, just
+edit `/etc/conf.d/git-daemon` as you see fit.  I added
+`--base-path=/var/git` and `--export-all` to `GITDAEMON_OPTS`.  Start
+the daemon with
+
+    # /etc/init.d/git-daemon start
+
+Add it to your default runlevel with
+
+    # rc-update add git-daemon default
+
+[summary]: http://www.philsergi.com/2008/04/gitweb-apache-gentoo.html
+
+[[!tag tags/git]]
+[[!tag tags/linux]]
+[[!tag tags/tools]]
+[[!tag tags/web]]