So, I want to install gitweb (http://git-scm.com and http://git.or.cz/gitwiki/Gitweb) on nearlyfreespeech.net for interest's sake more than anything else. I already have cgit, but I'm inquisitive or something.

Firstly, get a tar-ball of git, or get a source package of git somehow.

wget http://kernel.org/pub/software/scm/git/git-1.6.6.tar.bz2
tar -xf git-1.6.6.tar.bz2
cd git-1.6.6

Then, to find out appropriate commands, we can examine the files gitweb/README and gitweb/INSTALL.

In short, we need to run

$MAKE prefix=$PREFIX GITWEB_PROJECTROOT=../../path/to/git/folder/ \
GITWEB_SITENAME=aaatos.net GITWEB_HOME_LINK_STR='http://www.aaatos.net/git/gitweb.cgi' \
gitweb/gitweb.cgi

where $MAKE is the GNU make command, $PREFIX is the prefix for git, in my case /usr/local, and ../../path/to/git/folder is the directory in which to scan fir git projects. In my case, I know my web server's user sees a slightly different directory root than my shell user, so I used a relative path, which in this case is correct both for the compliation and the directory the script will be run from, which I suppose is the important one, though that might be wrong; experiment!

We then need to copy the files into place;

mkdir $WEBDIR/gitweb
cp gitweb/gitweb.cgi gitweb/gitweb.css gitweb/gitweb.js gitweb/git-logo.png gitweb/git-favicon.png $WEBDIR/gitweb

where $WEBDIR is the website root (or, the folder in which the gitweb folder should sit).

This is still not entriely satisfactory; gitweb works, but the owner field is still not quite right; I'd like to customise it, which should be possible according to README and INSTALL. To set the owner, for each repository, edit the $NAME.git/config file, and add the lines

[gitweb]
    owner = $YOUR_NAME

where the $YOUR_NAME is the name you would like displayed.

I intend to work out some rewriting so that the repository can be cloned over HTTP, but that's not done yet - more to follow, either in this post, or as a new one.

Comments on this page are closed.