Progress:
TIER 2 · MODULE 29· Intermediate

gitweb

Web frontend that ships with Git. Old. Still works.

🎯 What & why

gitweb is the original CGI-based repository browser bundled with Git. It serves a read-only web view of one or more bare repositories.

🧠 Mental model

Think of gitweb as a Perl CGI that walks your repo filesystem and renders summary, log, tree, blob, and commit pages. It is old, ugly, and reliable.

🛠️ Synopsis

gitweb is configured via gitweb.conf and served by any web server
that can run CGI (Apache, lighttpd, nginx+fcgiwrap).

Quick start without a real web server:
    git instaweb --httpd=lighttpd --port=1234

Production: build from gitweb/ and install the static assets +
gitweb.cgi behind your web server, with GITWEB_PROJECTROOT set.

🎚️ Switches & options

FlagWhat it does
GITWEB_PROJECTROOTFilesystem path under which bare repos live (passed at build/config time)
GITWEB_CONFIGPath to gitweb.conf override file
GITWEB_LISTExplicit list file of projects to expose
GITWEB_HOMETEXTPath to indextext.html shown on the front page
GITWEB_SITENAMEHeader title for your install
GITWEB_EXPORT_OK⚠️ If set, only repos containing this marker file are listed

📦 Subcommands

instaweb — Spin up a temporary local gitweb instance for the current repo
git instaweb --httpd=lighttpd --port=1234 --local
instaweb --stop — Stop the running instaweb server
git instaweb --stop

💡 Use cases

🧪 Examples

Run instaweb against the current repo
git instaweb --httpd=lighttpd --port=1234 --local
Visit the running instance
xdg-open http://127.0.0.1:1234/
Mark a bare repo as exportable
touch /srv/git/myrepo.git/git-daemon-export-ok && touch /srv/git/myrepo.git/.gitweb-export-ok
Build gitweb from the Git source tree
make GITWEB_PROJECTROOT=/srv/git GITWEB_SITENAME='RoboDoc Git' gitweb

🎓 Recommendations

🪤 Common pitfalls

🔗 Related modules

📝 Quiz

Hit each option, then Check answers. Score is recorded; Next is always open.