GITWEB(1) GITWEB(1) (NAME) gitweb - ( ) (SYNOPSIS) gitweb git-instaweb(1) . gitweb . (DESCRIPTION) Gitweb . : o . o . o . o . o / (blame/annotation) ( ). o RSS Atom . . o . o . gitweb gitweb https://repo.or.cz/w/git.git/tree/HEAD:/gitweb . (CONFIGURATION) gitweb gitweb_config.perl /etc/gitweb.conf . gitweb.conf(5) . (Repositories) Gitweb . ( << >> << >> ). our $projectroot = '/path/to/parent/directory'; $projectroot /pub/git . gitweb GITWEB_PROJECTROOT . $projectroot gitweb . $projectroot ( gitweb <> ). gitweb $GIT_DIR ( ) $projectroot . $repo "$projectroot/$repo" . (Projects list file format) gitweb $projectroot $projects_list ( ) . : o ( / ) ( ) . o . o ( "split(" ", $line)" ). o URI RFC 3986 . ( ) << >> ( https://en.wikipedia.org/wiki/Query_string#URL_encoding) SP (" ") "+" ( "+" ). : "%" ( ) "+" ( ) SP TAB LF ( ). o : GIT_DIR $projectroot project_index ( TXT ) gitweb << gitweb>> . : foo.git Joe+R+Hacker+ foo/bar.git O+W+Ner+ ( gitweb ). gitweb . $strict_export ( gitweb.conf(5) ) (true) ( ). gitweb (Generating projects list using gitweb) GITWEB_CONFIG Makefile gitweb_config.perl . gitweb_make_index.perl : read_config_file("gitweb_config.perl"); $projects_list = $projectroot; GITWEB_LIST ( $projects_list gitweb) : #!/bin/sh export GITWEB_CONFIG="gitweb_make_index.perl" export GATEWAY_INTERFACE="CGI/1.1" export HTTP_ACCEPT="*/*" export REQUEST_METHOD="GET" export QUERY_STRING="a=project_index" perl -- /var/www/cgi-bin/gitweb.cgi . $projects_list . (Controlling access to Git repositories) $projectroot gitweb . gitweb . o << >> $projects_list gitweb . $strict_export . o gitweb $export_ok gitweb gitweb.conf(5) . gitweb $export_ok ( $export_ok ). git-daemon(1) ( --export-all ) git-daemon-export-ok . our $export_ok = "git-daemon-export-ok"; gitweb git:// . o . () ( "$projectroot/$project"). mod_perl HTTP (dumb HTTP) : $export_auth_hook = sub { use Apache2::SubRequest (); use Apache2::Const -compile => qw(HTTP_OK); my $path = "$_[0]/HEAD"; my $r = Apache2::RequestUtil->request; my $sub = $r->lookup_file($path); return $sub->filename eq $path && $sub->status == Apache2::Const::HTTP_OK; }; gitweb (Per-repository gitweb configuration) gitweb GIT_DIR ( GIT_DIR/config git-config(1) ) . : README.html html ( HTML) ("summary") gitweb
. ( ) . XSS ($prevent_xss gitweb.conf(5) ) README XSS . description ( gitweb.description) ( $projects_list_description_width gitweb.conf(5) ) ( ). HTML . : Unnamed repository; edit this file to name it for gitweb. /usr/share/git-core/templates/ . gitweb.description . category ( gitweb.category) $projects_list_group_categories . ( ) $project_list_default_category . gitweb.category . $projects_list_group_categories $project_list_default_category gitweb.conf(5) . cloneurl ( gitweb.url) ( ) . . gitweb.url . / @git_base_url_list gitweb ( gitweb.conf(5) ). gitweb.owner gitweb.owner . . $projects_list ( gitweb $projectroot ) ( GECOS getpwuid(3)) $projects_list . gitweb.* ( ) () %feature . << gitweb>> gitweb.conf(5) . (ACTIONS, AND URLS) Gitweb path_info () (query) . gitweb : .../gitweb.cgi///:/? repo . . action . repo projects_list summary . revision . HEAD . path . arguments . . path_info () gitweb : .../gitweb.cgi///:/..:/? () %actions . (feature) . blame gitweb : $feature{'blame'}{'default'} = [1]; (Actions): : project_list . . summary . . heads, remotes . . tags ( ) . blob, tree . . blob_plain . raw . blobdiff . blame, blame_incremental ( ) . . ( ) Ajax . . commit, commitdiff . commit commitdiff (changeset) . patch git-am(1) . tag ( ) . log, shortlog ( ) ( ) . shortlog . history ( HEAD ). shortlog . rss, atom RSS ( Atom) . (WEBSERVER CONFIGURATION) gitweb . /path/to/gitweb gitweb gitweb_config.perl . gitweb . CGI (Apache as CGI) CGI gitweb . /var/www/cgi-bin . ScriptAlias /cgi-bin/ "/var/www/cgi-bin/" Options Indexes FollowSymlinks ExecCGI AllowOverride None Order allow,deny Allow from all : http://server/cgi-bin/gitweb.cgi mod_perl ModPerl::Registry (Apache with mod_perl, via ModPerl::Registry) mod_perl gitweb . Apache::Registry ( mod_perl 1.x) ModPerl::Registry ( mod_perl 2.x) . gitweb /var/www/perl ( mod_perl 2.x) . Alias /perl "/var/www/perl" SetHandler perl-script PerlResponseHandler ModPerl::Registry PerlOptions +ParseHeaders Options Indexes FollowSymlinks +ExecCGI AllowOverride None Order allow,deny Allow from all : http://server/perl/gitweb.cgi FastCGI (Apache with FastCGI) Gitweb FastCGI . gitweb.cgi gitweb.fcgi . gitweb /usr/share/gitweb . (!) FastCgiServer /usr/share/gitweb/gitweb.cgi ScriptAlias /gitweb /usr/share/gitweb/gitweb.cgi Alias /gitweb/static /usr/share/gitweb/static SetHandler default-handler : http://server/gitweb (ADVANCED WEB SERVER SETUP) mod_rewrite ( ) . gitweb (Single URL for gitweb and for fetching) gitweb http:// : ServerName git.example.org DocumentRoot /pub/git SetEnv GITWEB_CONFIG /etc/gitweb.conf # turning on mod rewrite RewriteEngine on # make the front page an internal rewrite to the gitweb script RewriteRule ^/$ /cgi-bin/gitweb.cgi # make access for "dumb clients" work RewriteRule ^/(.*\.git/(?!/?(HEAD|info|objects|refs)).*)?$ \ /cgi-bin/gitweb.cgi%{REQUEST_URI} [L,PT] /pub/git http://git.domain.org/dir-under-pub-git gitweb. git- daemon(1) --base-path=/pub/git --export-all git:// . GITWEB_CONFIG gitweb ( /etc/gitweb.conf) gitweb . ( gitweb) gitweb_config.perl /etc/gitweb.conf . gitweb.conf(5) . gitweb (/etc/gitweb.conf ) : @stylesheets = ("/some/absolute/path/gitweb.css"); $my_uri = "/"; $home_link = "/"; $per_request_config = 1; gitweb HTML ( URI ) . (Webserver configuration with multiple projects' root) gitweb gitweb . ( ) : ServerName git.example.org DocumentRoot /pub/git SetEnv GITWEB_CONFIG /etc/gitweb.conf # turning on mod rewrite RewriteEngine on # make the front page an internal rewrite to the gitweb script RewriteRule ^/$ /cgi-bin/gitweb.cgi [QSA,L,PT] # look for a public_git directory in unix users' home # http://git.example.org/~/ RewriteRule ^/\~([^\/]+)(/|/gitweb.cgi)?$ /cgi-bin/gitweb.cgi \ [QSA,E=GITWEB_PROJECTROOT:/home/$1/public_git/,L,PT] # http://git.example.org/+/ #RewriteRule ^/\+([^\/]+)(/|/gitweb.cgi)?$ /cgi-bin/gitweb.cgi \ [QSA,E=GITWEB_PROJECTROOT:/home/$1/public_git/,L,PT] # http://git.example.org/user// #RewriteRule ^/user/([^\/]+)/(gitweb.cgi)?$ /cgi-bin/gitweb.cgi \ [QSA,E=GITWEB_PROJECTROOT:/home/$1/public_git/,L,PT] # defined list of project roots RewriteRule ^/scm(/|/gitweb.cgi)?$ /cgi-bin/gitweb.cgi \ [QSA,E=GITWEB_PROJECTROOT:/pub/scm/,L,PT] RewriteRule ^/var(/|/gitweb.cgi)?$ /cgi-bin/gitweb.cgi \ [QSA,E=GITWEB_PROJECTROOT:/var/git/,L,PT] # make access for "dumb clients" work RewriteRule ^/(.*\.git/(?!/?(HEAD|info|objects|refs)).*)?$ \ /cgi-bin/gitweb.cgi%{REQUEST_URI} [L,PT] GITWEB_PROJECT_ROOT gitweb gitweb ( /etc/gitweb.conf) : $projectroot = $ENV{'GITWEB_PROJECTROOT'} || "/pub/git"; $per_request_config $per_request_config . () ~/public_git/ gitweb : http://git.example.org/~/ . `mod_userdir` '~' . /pub/scm/ /var/git/ http://git.example.org/scm/ http://git.example.org/var/ . . PATH_INFO (PATH_INFO usage) PATH_INFO gitweb $feature{'pathinfo'}{'default'} = [1]; gitweb : http://git.example.com/project.git/shortlog/sometag gitweb.cgi . /var/www/gitweb (DocumentRoot) gitweb.cgi ( ) : ServerAlias git.example.com DocumentRoot /var/www/gitweb Options ExecCGI AddHandler cgi-script cgi DirectoryIndex gitweb.cgi RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^.* /gitweb.cgi/$0 [L,PT] PATH_INFO gitweb . @stylesheets $my_uri $home_link << (dumb clients)>> git. ( << gitweb >> ). : ( /pub/git) git. ( /pub/git/project /pub/git/project.git) : ServerAlias git.example.com DocumentRoot /var/www/gitweb AliasMatch ^(/.*?)(\.git)(/.*)?$ /pub/git$1$3 Options ExecCGI AddHandler cgi-script cgi DirectoryIndex gitweb.cgi RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^.* /gitweb.cgi/$0 [L,PT] AliasMatch http://git.example.com/project.git ( ) http://git.example.com/project gitweb . ( ) git/ http://git.example.com/project/command/abranch..git/abranch . (BUGS) git@vger.kernel.org[1] "gitweb" . (SEE ALSO) gitweb.conf(5), git-instaweb(1) gitweb/README, gitweb/INSTALL (GIT) git(1) (NOTES) 1. git@vger.kernel.org mailto:git@vger.kernel.org Git 2.55.0 2026-06-29 GITWEB(1)