From e6ee99053c571db44790f36a420feaa9c8b5b118 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Thu, 8 Dec 2011 06:50:35 -0500 Subject: [PATCH] Add gitweb (and git-daemon) post. --- posts/gitweb.mdwn | 86 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 posts/gitweb.mdwn diff --git a/posts/gitweb.mdwn b/posts/gitweb.mdwn new file mode 100644 index 0000000..5ed7d52 --- /dev/null +++ b/posts/gitweb.mdwn @@ -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 + + ServerName git.example.net + DocumentRoot /usr/share/gitweb + + Allow from all + AllowOverride all + Order allow,deny + Options ExecCGI + + SetHandler cgi-script + + + DirectoryIndex gitweb.cgi + SetEnv GITWEB_CONFIG /etc/gitweb.conf + + 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]] -- 2.26.2