Mon 06 Jul 2020 08:30:14 AM UTC

gitweb Setup

Here’s my notes for setting up gitweb.

It assumes you have an nginx up and running and have configured certbot ala Luke Smith’s Tutorialand that you’ve set up git on your server according to the git-scm tutorial.

Just be sure to change YOUR_DOMAIN and YOUR_GIT_REPO_ROOT to match your setup.

# as root on the server
apt install gitweb fcgiwrap highlight
cat >/etc/gitweb.conf <<EOF
$projectroot = "YOUR_GIT_REPO_ROOT";
$feature{'search'}{'default'} = [0];
$feature{'grep'}{'default'} = [0];
$feature{'picaxe'}{'default'} = [0];
$feature{'highlight'}{'default'} = [1];
EOF

cat >/etc/nginx/sites-available/gitweb <<EOF
server {
  server_name YOUR_DOMAIN;
  listen 80;

  location /index.cgi {
    root /usr/share/gitweb/;
    include fastcgi_params;
    gzip off;
    fastcgi_param SCRIPT_NAME $uri;
    fastcgi_param GITWEB_CONFIG /etc/gitweb.conf;
    fastcgi_pass  unix:/var/run/fcgiwrap.socket;
  }
  location / {
    root /usr/share/gitweb/;
    index index.cgi;
  }
}
EOF

ln -s /etc/nginx/sites-available/gitweb /etc/nginx/sites-enabled/
certbot --nginx  # select your gitweb server
systemctl restart nginx

Trogdor!