Faster and easier Gitweb installation
The idea of using make to build Gitweb isn’t just excessively complex, it’s also mostly unnecessary. Building gitweb.cgi from gitweb.perl only changes 19 of the source file’s 6734 lines (0.2%).
Fact is, to get Gitweb working only one line needs changing. After the following edit, all local configuration values can be loaded from a simple config file.
On line 546, insert the name of your config file:
-our $GITWEB_CONFIG = $ENV{'GITWEB_CONFIG'} || "++GITWEB_CONFIG++";
+our $GITWEB_CONFIG = $ENV{'GITWEB_CONFIG'} || "gitweb_config.perl";
A set of fully-documented configuration files is available in the Simple Gitweb Config project on Github, to help get things up and running quickly.
Full instructions
Here are all the steps necessary to get Gitweb running on a webserver. In most cases, the configuration will work without modification, installation shouldn’t take more than five minutes start to finish.
- Create temporary source directory:
- Download and extract Git source and Simple Gitweb Config tarballs:
- Copy Git’s gitweb subdirectory to a web accessible location, then copy the gitweb config files into the live gitweb directory:
- Replace
++GITWEB_CONFIG++
withgitweb_config.perl
and make the resulting CGI executable: - Gitweb should be working now, but if necessary, edit projects_list.txt, gitweb_config.perl and customize the three html files for your environment.
mkdir ~/src && cd ~/src
curl -LO http://kernel.org/pub/software/scm/git/git-1.6.6.tar.gz
curl -LO http://github.com/joemaller/Simple-Gitweb-Config/tarball/master
tar -xvzf git-1.6.6.tar.gz
tar -xzvf master
cp -r git-1.6.6/gitweb ~/www/
cp joemaller-Simple-Gitweb-Config*/* ~/www/gitweb/
sed -re's/\++GITWEB_CONFIG\++/gitweb_config.perl/g' gitweb.perl > gitweb.cgi
chmod a+x gitweb.cgi
One last note, since it wasn’t immediately obvious to me. To change the default repository description, “Unnamed repository; edit this file to name it for gitweb.” edit the configuration file inside the .git folder. Descriptions are per-repository and do not update or transfer with pushes, pulls or clones.
I am getting 404 Project not found.
I have tried lots but still couldnt figure it out. Is there any proper log that gets generated? Apache logs ain’t helpful.
Just wanted to say thanks! I’m using this technique to easily execute GitWeb as a NodeJS module, and your technique is the core of it. Works great!
https://github.com/TooTallNate/node-gitweb