Installing tools
To publish Git repositories on Debian, I do:
# apt-get install git-daemon-run
To enable web browsing of Git repositories, I do:
# apt-get install gitweb libcgi-fast-perl libfcgi-procmanager-perl
Note that I run gitweb as Fast CGI service.
The package git-daemon-run is to invoke git-daemon. After installation of git-daemon-run and gitweb, I do:
# ln -s /usr/bin/sv /etc/init.d/git-daemon # edit /etc/sv/git-daemon/run # /etc/init.d/git-daemon restart
Editing the /etc/sv/git-daemon/run, I only offer --base-path=/home/gniibe/git to git-daemon.
I edit /etc/gitweb.conf so that it has:
$site_name = "Niibe's Git repo"; $projectroot = "/home/gniibe/git"; $site_header = "/home/gniibe/work/www.gniibe.org/gitweb-header.html";
I add running gitweb service (as Fast CGI) in /etc/rc.local.
echo 'gitweb fcgi service starting.' (cd /home/gniibe/www.gniibe.org && su gniibe -c \ 'while true; do FCGI_SOCKET_PATH=localhost:6821 /usr/lib/cgi-bin/gitweb.cgi -f;done'&)
Note that gitweb.cgi will serve 100 connections and exit. We need while loop to invoke it again.
Configure Unguent
I configure Unguent so that my repositories also can be served through http. I put following lines in ungent.conf:
[/git] tools.staticdir.on = True tools.staticdir.dir = unguent.parent_dir + "/git" tools.staticdir.disable_cache = True
Besides, I put following setting to [global] section:
gitweb = '/gitweb'
Since I put ungent under /home/gniibe/www.gniibe.org, ungent.parent_dir means /home/gniibe. So, http://www.gniibe.org/git/ goes to /home/gniibe/git/.
Things to be done for each repo
I need to configure each repository. Here is an example for Gnuk:
$ cd /home/gniibe/git $ cd gnuk.git $ touch git-daemon-export-ok $ edit description $ edit cloneurl $ cd hooks $ mv post-update.sample post-update
git-daemon-export-ok is needed for git protocol access by git-daemon.
When people browse repository by gitweb, the contents of description and cloneurl are displayed on the page.
post-update is needed for http access.