gitweb
Browse Git repositories via a web interface
SYNOPSIS
gitweb[.perl|.cgi] as CGI script with query string: /gitweb.cgi?action=browse&project=repo.git[&h=SHA1]
PARAMETERS
action
Action to perform: browse, tree, blob, blob_plain, blame, blame_incremental, commit, commitdiff, history, shortlog, log, tags, tag
project
Path to Git repository relative to $projectroot
f
Path to file or subdirectory within repository
h
SHA-1, revspec, or branch/tag name for view
hb
Revision for tree browsing (default: HEAD)
hr
Revision for history view
hp
Parent revision for commitdiff
hpb
Parent revision for browsing
dir
Subdirectory to browse (alias for path)
fr
From revision for diffs/logs
ft
To revision for diffs/logs
s
Search string for pickaxe
p
Path limiting for logs
pg
Page number for pagination
hash_base
Hash algorithm (base64)
javascript
Enable/disable JavaScript features (1/0)
DESCRIPTION
Gitweb is a simple, Perl-based CGI script bundled with Git that provides a web-based interface for browsing Git repositories.
It enables users to view repository contents, commit history, file trees, blame information, diffs, tags, and more directly in a web browser without requiring a Git client.
Ideal for hosting public or private Git repositories on a web server, gitweb supports multiple projects listing, syntax highlighting (via gitweb's built-in or external like highlight), and customizable features through a configuration file.
To deploy, place gitweb.perl (or compiled gitweb.cgi) in a web server's CGI directory, set up permissions on repositories, and configure gitweb_config.perl for paths like $projectroot, $projects_list, site header/footer, and features such as branch sorting or favicon.
Gitweb is lightweight, requiring no database, and runs efficiently on Apache, lighttpd, or Nginx with FastCGI for better performance.
It emphasizes simplicity over advanced features found in tools like Gitea or GitLab, making it perfect for quick setups or embedded hosting.
CAVEATS
Requires Perl and CGI-enabled web server; insecure for untrusted repos without gitweb_config.perl restrictions; no authentication built-in; high load may need FastCGI; repositories must be bare and readable by web server.
CONFIGURATION
Edit gitweb_config.perl for $projectroot (repo base dir), $projects_list (project list file/dir), $home_link, features like $feature_branchsort=1, and security ($prevent_xss=1).
STANDALONE RUN
Test locally: perl gitweb/gitweb.perl [--dump-accessors | --version | --help]; serves on port 8080 with --httpd.
SECURITY
Use $export_all_projects=0; set $strict_export; run under dedicated user; avoid world-readable repos.
HISTORY
Developed by Kay Sievers (2005-2006) as contrib/gitweb/; integrated into Git core around v1.4.2 (2007); maintained with enhancements like syntax highlighting, RSS feeds, and FastCGI support through Git v2.x.
SEE ALSO
git(1), cgit(1), git-instaweb(1), perl(1)


