blob: 2e219cd61191ce37e4a9e06fddae271d3133ad7d [file] [log] [blame]
'\" t
.\" Title: gitweb.conf
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 11/18/2018
.\" Manual: Git Manual
.\" Source: Git 2.20.0.rc0
.\" Language: English
.\"
.TH "GITWEB\&.CONF" "5" "11/18/2018" "Git 2\&.20\&.0\&.rc0" "Git Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
gitweb.conf \- Gitweb (Git web interface) configuration file
.SH "SYNOPSIS"
.sp
/etc/gitweb\&.conf, /etc/gitweb\-common\&.conf, $GITWEBDIR/gitweb_config\&.perl
.SH "DESCRIPTION"
.sp
The gitweb CGI script for viewing Git repositories over the web uses a perl script fragment as its configuration file\&. You can set variables using "\fBour $variable = value\fR"; text from a "#" character until the end of a line is ignored\&. See \fBperlsyn\fR(1) for details\&.
.sp
An example:
.sp
.if n \{\
.RS 4
.\}
.nf
# gitweb configuration file for http://git\&.example\&.org
#
our $projectroot = "/srv/git"; # FHS recommendation
our $site_name = \(aqExample\&.org >> Repos\(aq;
.fi
.if n \{\
.RE
.\}
.sp
.sp
The configuration file is used to override the default settings that were built into gitweb at the time the \fIgitweb\&.cgi\fR script was generated\&.
.sp
While one could just alter the configuration settings in the gitweb CGI itself, those changes would be lost upon upgrade\&. Configuration settings might also be placed into a file in the same directory as the CGI script with the default name \fIgitweb_config\&.perl\fR \(em allowing one to have multiple gitweb instances with different configurations by the use of symlinks\&.
.sp
Note that some configuration can be controlled on per\-repository rather than gitweb\-wide basis: see "Per\-repository gitweb configuration" subsection on \fBgitweb\fR(1) manpage\&.
.SH "DISCUSSION"
.sp
Gitweb reads configuration data from the following sources in the following order:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
built\-in values (some set during build stage),
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
common system\-wide configuration file (defaults to
\fI/etc/gitweb\-common\&.conf\fR),
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
either per\-instance configuration file (defaults to
\fIgitweb_config\&.perl\fR
in the same directory as the installed gitweb), or if it does not exists then fallback system\-wide configuration file (defaults to
\fI/etc/gitweb\&.conf\fR)\&.
.RE
.sp
Values obtained in later configuration files override values obtained earlier in the above sequence\&.
.sp
Locations of the common system\-wide configuration file, the fallback system\-wide configuration file and the per\-instance configuration file are defined at compile time using build\-time Makefile configuration variables, respectively \fBGITWEB_CONFIG_COMMON\fR, \fBGITWEB_CONFIG_SYSTEM\fR and \fBGITWEB_CONFIG\fR\&.
.sp
You can also override locations of gitweb configuration files during runtime by setting the following environment variables: \fBGITWEB_CONFIG_COMMON\fR, \fBGITWEB_CONFIG_SYSTEM\fR and \fBGITWEB_CONFIG\fR to a non\-empty value\&.
.sp
The syntax of the configuration files is that of Perl, since these files are handled by sourcing them as fragments of Perl code (the language that gitweb itself is written in)\&. Variables are typically set using the \fBour\fR qualifier (as in "\fBour $variable = <value>;\fR") to avoid syntax errors if a new version of gitweb no longer uses a variable and therefore stops declaring it\&.
.sp
You can include other configuration file using read_config_file() subroutine\&. For example, one might want to put gitweb configuration related to access control for viewing repositories via Gitolite (one of Git repository management tools) in a separate file, e\&.g\&. in \fI/etc/gitweb\-gitolite\&.conf\fR\&. To include it, put
.sp
.if n \{\
.RS 4
.\}
.nf
read_config_file("/etc/gitweb\-gitolite\&.conf");
.fi
.if n \{\
.RE
.\}
.sp
.sp
somewhere in gitweb configuration file used, e\&.g\&. in per\-installation gitweb configuration file\&. Note that read_config_file() checks itself that the file it reads exists, and does nothing if it is not found\&. It also handles errors in included file\&.
.sp
The default configuration with no configuration file at all may work perfectly well for some installations\&. Still, a configuration file is useful for customizing or tweaking the behavior of gitweb in many ways, and some optional features will not be present unless explicitly enabled using the configurable \fB%features\fR variable (see also "Configuring gitweb features" section below)\&.
.SH "CONFIGURATION VARIABLES"
.sp
Some configuration variables have their default values (embedded in the CGI script) set during building gitweb \(em if that is the case, this fact is put in their description\&. See gitweb\(cqs \fIINSTALL\fR file for instructions on building and installing gitweb\&.
.SS "Location of repositories"
.sp
The configuration variables described below control how gitweb finds Git repositories, and how repositories are displayed and accessed\&.
.sp
See also "Repositories" and later subsections in \fBgitweb\fR(1) manpage\&.
.PP
$projectroot
.RS 4
Absolute filesystem path which will be prepended to project path; the path to repository is
\fB$projectroot/$project\fR\&. Set to
\fB$GITWEB_PROJECTROOT\fR
during installation\&. This variable has to be set correctly for gitweb to find repositories\&.
.sp
For example, if
\fB$projectroot\fR
is set to "/srv/git" by putting the following in gitweb config file:
.sp
.if n \{\
.RS 4
.\}
.nf
our $projectroot = "/srv/git";
.fi
.if n \{\
.RE
.\}
.sp
then
.sp
.if n \{\
.RS 4
.\}
.nf
http://git\&.example\&.com/gitweb\&.cgi?p=foo/bar\&.git
.fi
.if n \{\
.RE
.\}
.sp
and its path_info based equivalent
.sp
.if n \{\
.RS 4
.\}
.nf
http://git\&.example\&.com/gitweb\&.cgi/foo/bar\&.git
.fi
.if n \{\
.RE
.\}
.sp
will map to the path
\fI/srv/git/foo/bar\&.git\fR
on the filesystem\&.
.RE
.PP
$projects_list
.RS 4
Name of a plain text file listing projects, or a name of directory to be scanned for projects\&.
.sp
Project list files should list one project per line, with each line having the following format
.sp
.if n \{\
.RS 4
.\}
.nf
<URI\-encoded filesystem path to repository> SP <URI\-encoded repository owner>
.fi
.if n \{\
.RE
.\}
.sp
The default value of this variable is determined by the
\fBGITWEB_LIST\fR
makefile variable at installation time\&. If this variable is empty, gitweb will fall back to scanning the
\fB$projectroot\fR
directory for repositories\&.
.RE
.PP
$project_maxdepth
.RS 4
If
\fB$projects_list\fR
variable is unset, gitweb will recursively scan filesystem for Git repositories\&. The
\fB$project_maxdepth\fR
is used to limit traversing depth, relative to
\fB$projectroot\fR
(starting point); it means that directories which are further from
\fB$projectroot\fR
than
\fB$project_maxdepth\fR
will be skipped\&.
.sp
It is purely performance optimization, originally intended for MacOS X, where recursive directory traversal is slow\&. Gitweb follows symbolic links, but it detects cycles, ignoring any duplicate files and directories\&.
.sp
The default value of this variable is determined by the build\-time configuration variable
\fBGITWEB_PROJECT_MAXDEPTH\fR, which defaults to 2007\&.
.RE
.PP
$export_ok
.RS 4
Show repository only if this file exists (in repository)\&. Only effective if this variable evaluates to true\&. Can be set when building gitweb by setting
\fBGITWEB_EXPORT_OK\fR\&. This path is relative to
\fBGIT_DIR\fR\&. git\-daemon[1] uses
\fIgit\-daemon\-export\-ok\fR, unless started with
\fB\-\-export\-all\fR\&. By default this variable is not set, which means that this feature is turned off\&.
.RE
.PP
$export_auth_hook
.RS 4
Function used to determine which repositories should be shown\&. This subroutine should take one parameter, the full path to a project, and if it returns true, that project will be included in the projects list and can be accessed through gitweb as long as it fulfills the other requirements described by $export_ok, $projects_list, and $projects_maxdepth\&. Example:
.sp
.if n \{\
.RS 4
.\}
.nf
our $export_auth_hook = sub { return \-e "$_[0]/git\-daemon\-export\-ok"; };
.fi
.if n \{\
.RE
.\}
.sp
though the above might be done by using
\fB$export_ok\fR
instead
.sp
.if n \{\
.RS 4
.\}
.nf
our $export_ok = "git\-daemon\-export\-ok";
.fi
.if n \{\
.RE
.\}
.sp
If not set (default), it means that this feature is disabled\&.
.sp
See also more involved example in "Controlling access to Git repositories" subsection on
\fBgitweb\fR(1)
manpage\&.
.RE
.PP
$strict_export
.RS 4
Only allow viewing of repositories also shown on the overview page\&. This for example makes
\fB$gitweb_export_ok\fR
file decide if repository is available and not only if it is shown\&. If
\fB$gitweb_list\fR
points to file with list of project, only those repositories listed would be available for gitweb\&. Can be set during building gitweb via
\fBGITWEB_STRICT_EXPORT\fR\&. By default this variable is not set, which means that you can directly access those repositories that are hidden from projects list page (e\&.g\&. the are not listed in the $projects_list file)\&.
.RE
.SS "Finding files"
.sp
The following configuration variables tell gitweb where to find files\&. The values of these variables are paths on the filesystem\&.
.PP
$GIT
.RS 4
Core git executable to use\&. By default set to
\fB$GIT_BINDIR/git\fR, which in turn is by default set to
\fB$(bindir)/git\fR\&. If you use Git installed from a binary package, you should usually set this to "/usr/bin/git"\&. This can just be "git" if your web server has a sensible PATH; from security point of view it is better to use absolute path to git binary\&. If you have multiple Git versions installed it can be used to choose which one to use\&. Must be (correctly) set for gitweb to be able to work\&.
.RE
.PP
$mimetypes_file
.RS 4
File to use for (filename extension based) guessing of MIME types before trying
\fI/etc/mime\&.types\fR\&.
\fBNOTE\fR
that this path, if relative, is taken as relative to the current Git repository, not to CGI script\&. If unset, only
\fI/etc/mime\&.types\fR
is used (if present on filesystem)\&. If no mimetypes file is found, mimetype guessing based on extension of file is disabled\&. Unset by default\&.
.RE
.PP
$highlight_bin
.RS 4
Path to the highlight executable to use (it must be the one from
\m[blue]\fBhttp://www\&.andre\-simon\&.de\fR\m[]
due to assumptions about parameters and output)\&. By default set to
\fIhighlight\fR; set it to full path to highlight executable if it is not installed on your web server\(cqs PATH\&. Note that
\fIhighlight\fR
feature must be set for gitweb to actually use syntax highlighting\&.
.sp
\fBNOTE\fR: for a file to be highlighted, its syntax type must be detected and that syntax must be supported by "highlight"\&. The default syntax detection is minimal, and there are many supported syntax types with no detection by default\&. There are three options for adding syntax detection\&. The first and second priority are
\fB%highlight_basename\fR
and
\fB%highlight_ext\fR, which detect based on basename (the full filename, for example "Makefile") and extension (for example "sh")\&. The keys of these hashes are the basename and extension, respectively, and the value for a given key is the name of the syntax to be passed via
\fB\-\-syntax <syntax>\fR
to "highlight"\&. The last priority is the "highlight" configuration of
\fBShebang\fR
regular expressions to detect the language based on the first line in the file, (for example, matching the line "#!/bin/bash")\&. See the highlight documentation and the default config at /etc/highlight/filetypes\&.conf for more details\&.
.sp
For example if repositories you are hosting use "phtml" extension for PHP files, and you want to have correct syntax\-highlighting for those files, you can add the following to gitweb configuration:
.sp
.if n \{\
.RS 4
.\}
.nf
our %highlight_ext;
$highlight_ext{\(aqphtml\(aq} = \(aqphp\(aq;
.fi
.if n \{\
.RE
.\}
.sp
.RE
.SS "Links and their targets"
.sp
The configuration variables described below configure some of gitweb links: their target and their look (text or image), and where to find page prerequisites (stylesheet, favicon, images, scripts)\&. Usually they are left at their default values, with the possible exception of \fB@stylesheets\fR variable\&.
.PP
@stylesheets
.RS 4
List of URIs of stylesheets (relative to the base URI of a page)\&. You might specify more than one stylesheet, for example to use "gitweb\&.css" as base with site specific modifications in a separate stylesheet to make it easier to upgrade gitweb\&. For example, you can add a
\fBsite\fR
stylesheet by putting
.sp
.if n \{\
.RS 4
.\}
.nf
push @stylesheets, "gitweb\-site\&.css";
.fi
.if n \{\
.RE
.\}
.sp
in the gitweb config file\&. Those values that are relative paths are relative to base URI of gitweb\&.
.sp
This list should contain the URI of gitweb\(cqs standard stylesheet\&. The default URI of gitweb stylesheet can be set at build time using the
\fBGITWEB_CSS\fR
makefile variable\&. Its default value is
\fIstatic/gitweb\&.css\fR
(or
\fIstatic/gitweb\&.min\&.css\fR
if the
\fBCSSMIN\fR
variable is defined, i\&.e\&. if CSS minifier is used during build)\&.
.sp
\fBNote\fR: there is also a legacy
\fB$stylesheet\fR
configuration variable, which was used by older gitweb\&. If
\fB$stylesheet\fR
variable is defined, only CSS stylesheet given by this variable is used by gitweb\&.
.RE
.PP
$logo
.RS 4
Points to the location where you put
\fIgit\-logo\&.png\fR
on your web server, or to be more the generic URI of logo, 72x27 size)\&. This image is displayed in the top right corner of each gitweb page and used as a logo for the Atom feed\&. Relative to the base URI of gitweb (as a path)\&. Can be adjusted when building gitweb using
\fBGITWEB_LOGO\fR
variable By default set to
\fIstatic/git\-logo\&.png\fR\&.
.RE
.PP
$favicon
.RS 4
Points to the location where you put
\fIgit\-favicon\&.png\fR
on your web server, or to be more the generic URI of favicon, which will be served as "image/png" type\&. Web browsers that support favicons (website icons) may display them in the browser\(cqs URL bar and next to the site name in bookmarks\&. Relative to the base URI of gitweb\&. Can be adjusted at build time using
\fBGITWEB_FAVICON\fR
variable\&. By default set to
\fIstatic/git\-favicon\&.png\fR\&.
.RE
.PP
$javascript
.RS 4
Points to the location where you put
\fIgitweb\&.js\fR
on your web server, or to be more generic the URI of JavaScript code used by gitweb\&. Relative to the base URI of gitweb\&. Can be set at build time using the
\fBGITWEB_JS\fR
build\-time configuration variable\&.
.sp
The default value is either
\fIstatic/gitweb\&.js\fR, or
\fIstatic/gitweb\&.min\&.js\fR
if the
\fBJSMIN\fR
build variable was defined, i\&.e\&. if JavaScript minifier was used at build time\&.
\fBNote\fR
that this single file is generated from multiple individual JavaScript "modules"\&.
.RE
.PP
$home_link
.RS 4
Target of the home link on the top of all pages (the first part of view "breadcrumbs")\&. By default it is set to the absolute URI of a current page (to the value of
\fB$my_uri\fR
variable, or to "/" if
\fB$my_uri\fR
is undefined or is an empty string)\&.
.RE
.PP
$home_link_str
.RS 4
Label for the "home link" at the top of all pages, leading to
\fB$home_link\fR
(usually the main gitweb page, which contains the projects list)\&. It is used as the first component of gitweb\(cqs "breadcrumb trail":
\fB<home link> / <project> / <action>\fR\&. Can be set at build time using the
\fBGITWEB_HOME_LINK_STR\fR
variable\&. By default it is set to "projects", as this link leads to the list of projects\&. Another popular choice is to set it to the name of site\&. Note that it is treated as raw HTML so it should not be set from untrusted sources\&.
.RE
.PP
@extra_breadcrumbs
.RS 4
Additional links to be added to the start of the breadcrumb trail before the home link, to pages that are logically "above" the gitweb projects list, such as the organization and department which host the gitweb server\&. Each element of the list is a reference to an array, in which element 0 is the link text (equivalent to
\fB$home_link_str\fR) and element 1 is the target URL (equivalent to
\fB$home_link\fR)\&.
.sp
For example, the following setting produces a breadcrumb trail like "home / dev / projects / \&..." where "projects" is the home link\&.
.sp
.if n \{\
.RS 4
.\}
.nf
our @extra_breadcrumbs = (
[ \(aqhome\(aq => \(aqhttps://www\&.example\&.org/\(aq ],
[ \(aqdev\(aq => \(aqhttps://dev\&.example\&.org/\(aq ],
);
.fi
.if n \{\
.RE
.\}
.sp
.RE
.PP
$logo_url, $logo_label
.RS 4
URI and label (title) for the Git logo link (or your site logo, if you chose to use different logo image)\&. By default, these both refer to Git homepage,
\m[blue]\fBhttps://git\-scm\&.com\fR\m[]; in the past, they pointed to Git documentation at
\m[blue]\fBhttps://www\&.kernel\&.org\fR\m[]\&.
.RE
.SS "Changing gitweb\(cqs look"
.sp
You can adjust how pages generated by gitweb look using the variables described below\&. You can change the site name, add common headers and footers for all pages, and add a description of this gitweb installation on its main page (which is the projects list page), etc\&.
.PP
$site_name
.RS 4
Name of your site or organization, to appear in page titles\&. Set it to something descriptive for clearer bookmarks etc\&. If this variable is not set or is, then gitweb uses the value of the
\fBSERVER_NAME\fR
\fBCGI\fR
environment variable, setting site name to "$SERVER_NAME Git", or "Untitled Git" if this variable is not set (e\&.g\&. if running gitweb as standalone script)\&.
.sp
Can be set using the
\fBGITWEB_SITENAME\fR
at build time\&. Unset by default\&.
.RE
.PP
$site_html_head_string
.RS 4
HTML snippet to be included in the <head> section of each page\&. Can be set using
\fBGITWEB_SITE_HTML_HEAD_STRING\fR
at build time\&. No default value\&.
.RE
.PP
$site_header
.RS 4
Name of a file with HTML to be included at the top of each page\&. Relative to the directory containing the
\fIgitweb\&.cgi\fR
script\&. Can be set using
\fBGITWEB_SITE_HEADER\fR
at build time\&. No default value\&.
.RE
.PP
$site_footer
.RS 4
Name of a file with HTML to be included at the bottom of each page\&. Relative to the directory containing the
\fIgitweb\&.cgi\fR
script\&. Can be set using
\fBGITWEB_SITE_FOOTER\fR
at build time\&. No default value\&.
.RE
.PP
$home_text
.RS 4
Name of a HTML file which, if it exists, is included on the gitweb projects overview page ("projects_list" view)\&. Relative to the directory containing the gitweb\&.cgi script\&. Default value can be adjusted during build time using
\fBGITWEB_HOMETEXT\fR
variable\&. By default set to
\fIindextext\&.html\fR\&.
.RE
.PP
$projects_list_description_width
.RS 4
The width (in characters) of the "Description" column of the projects list\&. Longer descriptions will be truncated (trying to cut at word boundary); the full description is available in the
\fItitle\fR
attribute (usually shown on mouseover)\&. The default is 25, which might be too small if you use long project descriptions\&.
.RE
.PP
$default_projects_order
.RS 4
Default value of ordering of projects on projects list page, which means the ordering used if you don\(cqt explicitly sort projects list (if there is no "o" CGI query parameter in the URL)\&. Valid values are "none" (unsorted), "project" (projects are by project name, i\&.e\&. path to repository relative to
\fB$projectroot\fR), "descr" (project description), "owner", and "age" (by date of most current commit)\&.
.sp
Default value is "project"\&. Unknown value means unsorted\&.
.RE
.SS "Changing gitweb\(cqs behavior"
.sp
These configuration variables control \fIinternal\fR gitweb behavior\&.
.PP
$default_blob_plain_mimetype
.RS 4
Default mimetype for the blob_plain (raw) view, if mimetype checking doesn\(cqt result in some other type; by default "text/plain"\&. Gitweb guesses mimetype of a file to display based on extension of its filename, using
\fB$mimetypes_file\fR
(if set and file exists) and
\fI/etc/mime\&.types\fR
files (see
\fBmime\&.types\fR(5) manpage; only filename extension rules are supported by gitweb)\&.
.RE
.PP
$default_text_plain_charset
.RS 4
Default charset for text files\&. If this is not set, the web server configuration will be used\&. Unset by default\&.
.RE
.PP
$fallback_encoding
.RS 4
Gitweb assumes this charset when a line contains non\-UTF\-8 characters\&. The fallback decoding is used without error checking, so it can be even "utf\-8"\&. The value must be a valid encoding; see the
\fBEncoding::Supported\fR(3pm) man page for a list\&. The default is "latin1", aka\&. "iso\-8859\-1"\&.
.RE
.PP
@diff_opts
.RS 4
Rename detection options for git\-diff and git\-diff\-tree\&. The default is (\(aq\-M\(aq); set it to (\(aq\-C\(aq) or (\(aq\-C\(aq, \(aq\-C\(aq) to also detect copies, or set it to () i\&.e\&. empty list if you don\(cqt want to have renames detection\&.
.sp
\fBNote\fR
that rename and especially copy detection can be quite CPU\-intensive\&. Note also that non Git tools can have problems with patches generated with options mentioned above, especially when they involve file copies (\(aq\-C\(aq) or criss\-cross renames (\(aq\-B\(aq)\&.
.RE
.SS "Some optional features and policies"
.sp
Most of features are configured via \fB%feature\fR hash; however some of extra gitweb features can be turned on and configured using variables described below\&. This list beside configuration variables that control how gitweb looks does contain variables configuring administrative side of gitweb (e\&.g\&. cross\-site scripting prevention; admittedly this as side effect affects how "summary" pages look like, or load limiting)\&.
.PP
@git_base_url_list
.RS 4
List of Git base URLs\&. These URLs are used to generate URLs describing from where to fetch a project, which are shown on project summary page\&. The full fetch URL is "\fB$git_base_url/$project\fR", for each element of this list\&. You can set up multiple base URLs (for example one for
\fBgit://\fR
protocol, and one for
\fBhttp://\fR
protocol)\&.
.sp
Note that per repository configuration can be set in
\fI$GIT_DIR/cloneurl\fR
file, or as values of multi\-value
\fBgitweb\&.url\fR
configuration variable in project config\&. Per\-repository configuration takes precedence over value composed from
\fB@git_base_url_list\fR
elements and project name\&.
.sp
You can setup one single value (single entry/item in this list) at build time by setting the
\fBGITWEB_BASE_URL\fR
build\-time configuration variable\&. By default it is set to (), i\&.e\&. an empty list\&. This means that gitweb would not try to create project URL (to fetch) from project name\&.
.RE
.PP
$projects_list_group_categories
.RS 4
Whether to enable the grouping of projects by category on the project list page\&. The category of a project is determined by the
\fB$GIT_DIR/category\fR
file or the
\fBgitweb\&.category\fR
variable in each repository\(cqs configuration\&. Disabled by default (set to 0)\&.
.RE
.PP
$project_list_default_category
.RS 4
Default category for projects for which none is specified\&. If this is set to the empty string, such projects will remain uncategorized and listed at the top, above categorized projects\&. Used only if project categories are enabled, which means if
\fB$projects_list_group_categories\fR
is true\&. By default set to "" (empty string)\&.
.RE
.PP
$prevent_xss
.RS 4
If true, some gitweb features are disabled to prevent content in repositories from launching cross\-site scripting (XSS) attacks\&. Set this to true if you don\(cqt trust the content of your repositories\&. False by default (set to 0)\&.
.RE
.PP
$maxload
.RS 4
Used to set the maximum load that we will still respond to gitweb queries\&. If the server load exceeds this value then gitweb will return "503 Service Unavailable" error\&. The server load is taken to be 0 if gitweb cannot determine its value\&. Currently it works only on Linux, where it uses
\fI/proc/loadavg\fR; the load there is the number of active tasks on the system \(em processes that are actually running \(em averaged over the last minute\&.
.sp
Set
\fB$maxload\fR
to undefined value (\fBundef\fR) to turn this feature off\&. The default value is 300\&.
.RE
.PP
$omit_age_column
.RS 4
If true, omit the column with date of the most current commit on the projects list page\&. It can save a bit of I/O and a fork per repository\&.
.RE
.PP
$omit_owner
.RS 4
If true prevents displaying information about repository owner\&.
.RE
.PP
$per_request_config
.RS 4
If this is set to code reference, it will be run once for each request\&. You can set parts of configuration that change per session this way\&. For example, one might use the following code in a gitweb configuration file
.sp
.if n \{\
.RS 4
.\}
.nf
our $per_request_config = sub {
$ENV{GL_USER} = $cgi\->remote_user || "gitweb";
};
.fi
.if n \{\
.RE
.\}
.sp
If
\fB$per_request_config\fR
is not a code reference, it is interpreted as boolean value\&. If it is true gitweb will process config files once per request, and if it is false gitweb will process config files only once, each time it is executed\&. True by default (set to 1)\&.
.sp
\fBNOTE\fR:
\fB$my_url\fR,
\fB$my_uri\fR, and
\fB$base_url\fR
are overwritten with their default values before every request, so if you want to change them, be sure to set this variable to true or a code reference effecting the desired changes\&.
.sp
This variable matters only when using persistent web environments that serve multiple requests using single gitweb instance, like mod_perl, FastCGI or Plackup\&.
.RE
.SS "Other variables"
.sp
Usually you should not need to change (adjust) any of configuration variables described below; they should be automatically set by gitweb to correct value\&.
.PP
$version
.RS 4
Gitweb version, set automatically when creating gitweb\&.cgi from gitweb\&.perl\&. You might want to modify it if you are running modified gitweb, for example
.sp
.if n \{\
.RS 4
.\}
.nf
our $version \&.= " with caching";
.fi
.if n \{\
.RE
.\}
.sp
if you run modified version of gitweb with caching support\&. This variable is purely informational, used e\&.g\&. in the "generator" meta header in HTML header\&.
.RE
.PP
$my_url, $my_uri
.RS 4
Full URL and absolute URL of the gitweb script; in earlier versions of gitweb you might have need to set those variables, but now there should be no need to do it\&. See
\fB$per_request_config\fR
if you need to set them still\&.
.RE
.PP
$base_url
.RS 4
Base URL for relative URLs in pages generated by gitweb, (e\&.g\&.
\fB$logo\fR,
\fB$favicon\fR,
\fB@stylesheets\fR
if they are relative URLs), needed and used
\fI<base href="$base_url">\fR
only for URLs with nonempty PATH_INFO\&. Usually gitweb sets its value correctly, and there is no need to set this variable, e\&.g\&. to $my_uri or "/"\&. See
\fB$per_request_config\fR
if you need to override it anyway\&.
.RE
.SH "CONFIGURING GITWEB FEATURES"
.sp
Many gitweb features can be enabled (or disabled) and configured using the \fB%feature\fR hash\&. Names of gitweb features are keys of this hash\&.
.sp
Each \fB%feature\fR hash element is a hash reference and has the following structure:
.sp
.if n \{\
.RS 4
.\}
.nf
"<feature_name>" => {
"sub" => <feature\-sub (subroutine)>,
"override" => <allow\-override (boolean)>,
"default" => [ <options>\&.\&.\&. ]
},
.fi
.if n \{\
.RE
.\}
.sp
.sp
Some features cannot be overridden per project\&. For those features the structure of appropriate \fB%feature\fR hash element has a simpler form:
.sp
.if n \{\
.RS 4
.\}
.nf
"<feature_name>" => {
"override" => 0,
"default" => [ <options>\&.\&.\&. ]
},
.fi
.if n \{\
.RE
.\}
.sp
.sp
As one can see it lacks the \(aqsub\(aq element\&.
.sp
The meaning of each part of feature configuration is described below:
.PP
default
.RS 4
List (array reference) of feature parameters (if there are any), used also to toggle (enable or disable) given feature\&.
.sp
Note that it is currently
\fBalways\fR
an array reference, even if feature doesn\(cqt accept any configuration parameters, and \(aqdefault\(aq is used only to turn it on or off\&. In such case you turn feature on by setting this element to
\fB[1]\fR, and torn it off by setting it to
\fB[0]\fR\&. See also the passage about the "blame" feature in the "Examples" section\&.
.sp
To disable features that accept parameters (are configurable), you need to set this element to empty list i\&.e\&.
\fB[]\fR\&.
.RE
.PP
override
.RS 4
If this field has a true value then the given feature is overridable, which means that it can be configured (or enabled/disabled) on a per\-repository basis\&.
.sp
Usually given "<feature>" is configurable via the
\fBgitweb\&.<feature>\fR
config variable in the per\-repository Git configuration file\&.
.sp
\fBNote\fR
that no feature is overridable by default\&.
.RE
.PP
sub
.RS 4
Internal detail of implementation\&. What is important is that if this field is not present then per\-repository override for given feature is not supported\&.
.sp
You wouldn\(cqt need to ever change it in gitweb config file\&.
.RE
.SS "Features in \fB%feature\fR"
.sp
The gitweb features that are configurable via \fB%feature\fR hash are listed below\&. This should be a complete list, but ultimately the authoritative and complete list is in gitweb\&.cgi source code, with features described in the comments\&.
.PP
blame
.RS 4
Enable the "blame" and "blame_incremental" blob views, showing for each line the last commit that modified it; see
\fBgit-blame\fR(1)\&. This can be very CPU\-intensive and is therefore disabled by default\&.
.sp
This feature can be configured on a per\-repository basis via repository\(cqs
\fBgitweb\&.blame\fR
configuration variable (boolean)\&.
.RE
.PP
snapshot
.RS 4
Enable and configure the "snapshot" action, which allows user to download a compressed archive of any tree or commit, as produced by
\fBgit-archive\fR(1)
and possibly additionally compressed\&. This can potentially generate high traffic if you have large project\&.
.sp
The value of \(aqdefault\(aq is a list of names of snapshot formats, defined in
\fB%known_snapshot_formats\fR
hash, that you wish to offer\&. Supported formats include "tgz", "tbz2", "txz" (gzip/bzip2/xz compressed tar archive) and "zip"; please consult gitweb sources for a definitive list\&. By default only "tgz" is offered\&.
.sp
This feature can be configured on a per\-repository basis via repository\(cqs
\fBgitweb\&.blame\fR
configuration variable, which contains a comma separated list of formats or "none" to disable snapshots\&. Unknown values are ignored\&.
.RE
.PP
grep
.RS 4
Enable grep search, which lists the files in currently selected tree (directory) containing the given string; see
\fBgit-grep\fR(1)\&. This can be potentially CPU\-intensive, of course\&. Enabled by default\&.
.sp
This feature can be configured on a per\-repository basis via repository\(cqs
\fBgitweb\&.grep\fR
configuration variable (boolean)\&.
.RE
.PP
pickaxe
.RS 4
Enable the so called pickaxe search, which will list the commits that introduced or removed a given string in a file\&. This can be practical and quite faster alternative to "blame" action, but it is still potentially CPU\-intensive\&. Enabled by default\&.
.sp
The pickaxe search is described in
\fBgit-log\fR(1)
(the description of
\fB\-S<string>\fR
option, which refers to pickaxe entry in
\fBgitdiffcore\fR(7)
for more details)\&.
.sp
This feature can be configured on a per\-repository basis by setting repository\(cqs
\fBgitweb\&.pickaxe\fR
configuration variable (boolean)\&.
.RE
.PP
show\-sizes
.RS 4
Enable showing size of blobs (ordinary files) in a "tree" view, in a separate column, similar to what
\fBls \-l\fR
does; see description of
\fB\-l\fR
option in
\fBgit-ls-tree\fR(1)
manpage\&. This costs a bit of I/O\&. Enabled by default\&.
.sp
This feature can be configured on a per\-repository basis via repository\(cqs
\fBgitweb\&.showSizes\fR
configuration variable (boolean)\&.
.RE
.PP
patches
.RS 4
Enable and configure "patches" view, which displays list of commits in email (plain text) output format; see also
\fBgit-format-patch\fR(1)\&. The value is the maximum number of patches in a patchset generated in "patches" view\&. Set the
\fIdefault\fR
field to a list containing single item of or to an empty list to disable patch view, or to a list containing a single negative number to remove any limit\&. Default value is 16\&.
.sp
This feature can be configured on a per\-repository basis via repository\(cqs
\fBgitweb\&.patches\fR
configuration variable (integer)\&.
.RE
.PP
avatar
.RS 4
Avatar support\&. When this feature is enabled, views such as "shortlog" or "commit" will display an avatar associated with the email of each committer and author\&.
.sp
Currently available providers are
\fB"gravatar"\fR
and
\fB"picon"\fR\&. Only one provider at a time can be selected (\fIdefault\fR
is one element list)\&. If an unknown provider is specified, the feature is disabled\&.
\fBNote\fR
that some providers might require extra Perl packages to be installed; see
\fIgitweb/INSTALL\fR
for more details\&.
.sp
This feature can be configured on a per\-repository basis via repository\(cqs
\fBgitweb\&.avatar\fR
configuration variable\&.
.sp
See also
\fB%avatar_size\fR
with pixel sizes for icons and avatars ("default" is used for one\-line like "log" and "shortlog", "double" is used for two\-line like "commit", "commitdiff" or "tag")\&. If the default font sizes or lineheights are changed (e\&.g\&. via adding extra CSS stylesheet in
\fB@stylesheets\fR), it may be appropriate to change these values\&.
.RE
.PP
highlight
.RS 4
Server\-side syntax highlight support in "blob" view\&. It requires
\fB$highlight_bin\fR
program to be available (see the description of this variable in the "Configuration variables" section above), and therefore is disabled by default\&.
.sp
This feature can be configured on a per\-repository basis via repository\(cqs
\fBgitweb\&.highlight\fR
configuration variable (boolean)\&.
.RE
.PP
remote_heads
.RS 4
Enable displaying remote heads (remote\-tracking branches) in the "heads" list\&. In most cases the list of remote\-tracking branches is an unnecessary internal private detail, and this feature is therefore disabled by default\&.
\fBgit-instaweb\fR(1), which is usually used to browse local repositories, enables and uses this feature\&.
.sp
This feature can be configured on a per\-repository basis via repository\(cqs
\fBgitweb\&.remote_heads\fR
configuration variable (boolean)\&.
.RE
.sp
The remaining features cannot be overridden on a per project basis\&.
.PP
search
.RS 4
Enable text search, which will list the commits which match author, committer or commit text to a given string; see the description of
\fB\-\-author\fR,
\fB\-\-committer\fR
and
\fB\-\-grep\fR
options in
\fBgit-log\fR(1)
manpage\&. Enabled by default\&.
.sp
Project specific override is not supported\&.
.RE
.PP
forks
.RS 4
If this feature is enabled, gitweb considers projects in subdirectories of project root (basename) to be forks of existing projects\&. For each project
\fB$projname\&.git\fR, projects in the
\fB$projname/\fR
directory and its subdirectories will not be shown in the main projects list\&. Instead, a \(aq+\(aq mark is shown next to
\fB$projname\fR, which links to a "forks" view that lists all the forks (all projects in
\fB$projname/\fR
subdirectory)\&. Additionally a "forks" view for a project is linked from project summary page\&.
.sp
If the project list is taken from a file (\fB$projects_list\fR
points to a file), forks are only recognized if they are listed after the main project in that file\&.
.sp
Project specific override is not supported\&.
.RE
.PP
actions
.RS 4
Insert custom links to the action bar of all project pages\&. This allows you to link to third\-party scripts integrating into gitweb\&.
.sp
The "default" value consists of a list of triplets in the form \(oq("<label>", "<link>", "<position>")` where "position" is the label after which to insert the link, "link" is a format string where
\fB%n\fR
expands to the project name,
\fB%f\fR
to the project path within the filesystem (i\&.e\&. "$projectroot/$project"),
\fB%h\fR
to the current hash (\(aqh\(cq gitweb parameter) and \(oq%b` to the current hash base (\(aqhb\(cq gitweb parameter); \(oq%%` expands to \(aq%\(cq\&.
.sp
For example, at the time this page was written, the
\m[blue]\fBhttp://repo\&.or\&.cz\fR\m[]
Git hosting site set it to the following to enable graphical log (using the third party tool
\fBgit\-browser\fR):
.sp
.if n \{\
.RS 4
.\}
.nf
$feature{\(aqactions\(aq}{\(aqdefault\(aq} =
[ (\(aqgraphiclog\(aq, \(aq/git\-browser/by\-commit\&.html?r=%n\(aq, \(aqsummary\(aq)];
.fi
.if n \{\
.RE
.\}
.sp
This adds a link titled "graphiclog" after the "summary" link, leading to
\fBgit\-browser\fR
script, passing
\fBr=<project>\fR
as a query parameter\&.
.sp
Project specific override is not supported\&.
.RE
.PP
timed
.RS 4
Enable displaying how much time and how many Git commands it took to generate and display each page in the page footer (at the bottom of page)\&. For example the footer might contain: "This page took 6\&.53325 seconds and 13 Git commands to generate\&." Disabled by default\&.
.sp
Project specific override is not supported\&.
.RE
.PP
javascript\-timezone
.RS 4
Enable and configure the ability to change a common time zone for dates in gitweb output via JavaScript\&. Dates in gitweb output include authordate and committerdate in "commit", "commitdiff" and "log" views, and taggerdate in "tag" view\&. Enabled by default\&.
.sp
The value is a list of three values: a default time zone (for if the client hasn\(cqt selected some other time zone and saved it in a cookie), a name of cookie where to store selected time zone, and a CSS class used to mark up dates for manipulation\&. If you want to turn this feature off, set "default" to empty list:
\fB[]\fR\&.
.sp
Typical gitweb config files will only change starting (default) time zone, and leave other elements at their default values:
.sp
.if n \{\
.RS 4
.\}
.nf
$feature{\(aqjavascript\-timezone\(aq}{\(aqdefault\(aq}[0] = "utc";
.fi
.if n \{\
.RE
.\}
.sp
The example configuration presented here is guaranteed to be backwards and forward compatible\&.
.sp
Time zone values can be "local" (for local time zone that browser uses), "utc" (what gitweb uses when JavaScript or this feature is disabled), or numerical time zones in the form of "+/\-HHMM", such as "+0200"\&.
.sp
Project specific override is not supported\&.
.RE
.PP
extra\-branch\-refs
.RS 4
List of additional directories under "refs" which are going to be used as branch refs\&. For example if you have a gerrit setup where all branches under refs/heads/ are official, push\-after\-review ones and branches under refs/sandbox/, refs/wip and refs/other are user ones where permissions are much wider, then you might want to set this variable as follows:
.sp
.if n \{\
.RS 4
.\}
.nf
$feature{\(aqextra\-branch\-refs\(aq}{\(aqdefault\(aq} =
[\(aqsandbox\(aq, \(aqwip\(aq, \(aqother\(aq];
.fi
.if n \{\
.RE
.\}
.sp
This feature can be configured on per\-repository basis after setting $feature{\fIextra\-branch\-refs\fR}{\fIoverride\fR} to true, via repository\(cqs
\fBgitweb\&.extraBranchRefs\fR
configuration variable, which contains a space separated list of refs\&. An example:
.sp
.if n \{\
.RS 4
.\}
.nf
[gitweb]
extraBranchRefs = sandbox wip other
.fi
.if n \{\
.RE
.\}
.sp
The gitweb\&.extraBranchRefs is actually a multi\-valued configuration variable, so following example is also correct and the result is the same as of the snippet above:
.sp
.if n \{\
.RS 4
.\}
.nf
[gitweb]
extraBranchRefs = sandbox
extraBranchRefs = wip other
.fi
.if n \{\
.RE
.\}
.sp
It is an error to specify a ref that does not pass "git check\-ref\-format" scrutiny\&. Duplicated values are filtered\&.
.RE
.SH "EXAMPLES"
.sp
To enable blame, pickaxe search, and snapshot support (allowing "tar\&.gz" and "zip" snapshots), while allowing individual projects to turn them off, put the following in your GITWEB_CONFIG file:
.sp
.if n \{\
.RS 4
.\}
.nf
$feature{\(aqblame\(aq}{\(aqdefault\(aq} = [1];
$feature{\(aqblame\(aq}{\(aqoverride\(aq} = 1;
$feature{\(aqpickaxe\(aq}{\(aqdefault\(aq} = [1];
$feature{\(aqpickaxe\(aq}{\(aqoverride\(aq} = 1;
$feature{\(aqsnapshot\(aq}{\(aqdefault\(aq} = [\(aqzip\(aq, \(aqtgz\(aq];
$feature{\(aqsnapshot\(aq}{\(aqoverride\(aq} = 1;
.fi
.if n \{\
.RE
.\}
.sp
.sp
If you allow overriding for the snapshot feature, you can specify which snapshot formats are globally disabled\&. You can also add any command\-line options you want (such as setting the compression level)\&. For instance, you can disable Zip compressed snapshots and set \fBgzip\fR(1) to run at level 6 by adding the following lines to your gitweb configuration file:
.sp
.if n \{\
.RS 4
.\}
.nf
$known_snapshot_formats{\(aqzip\(aq}{\(aqdisabled\(aq} = 1;
$known_snapshot_formats{\(aqtgz\(aq}{\(aqcompressor\(aq} = [\(aqgzip\(aq,\(aq\-6\(aq];
.fi
.if n \{\
.RE
.\}
.SH "BUGS"
.sp
Debugging would be easier if the fallback configuration file (\fB/etc/gitweb\&.conf\fR) and environment variable to override its location (\fIGITWEB_CONFIG_SYSTEM\fR) had names reflecting their "fallback" role\&. The current names are kept to avoid breaking working setups\&.
.SH "ENVIRONMENT"
.sp
The location of per\-instance and system\-wide configuration files can be overridden using the following environment variables:
.PP
GITWEB_CONFIG
.RS 4
Sets location of per\-instance configuration file\&.
.RE
.PP
GITWEB_CONFIG_SYSTEM
.RS 4
Sets location of fallback system\-wide configuration file\&. This file is read only if per\-instance one does not exist\&.
.RE
.PP
GITWEB_CONFIG_COMMON
.RS 4
Sets location of common system\-wide configuration file\&.
.RE
.SH "FILES"
.PP
gitweb_config\&.perl
.RS 4
This is default name of per\-instance configuration file\&. The format of this file is described above\&.
.RE
.PP
/etc/gitweb\&.conf
.RS 4
This is default name of fallback system\-wide configuration file\&. This file is used only if per\-instance configuration variable is not found\&.
.RE
.PP
/etc/gitweb\-common\&.conf
.RS 4
This is default name of common system\-wide configuration file\&.
.RE
.SH "SEE ALSO"
.sp
\fBgitweb\fR(1), \fBgit-instaweb\fR(1)
.sp
\fIgitweb/README\fR, \fIgitweb/INSTALL\fR
.SH "GIT"
.sp
Part of the \fBgit\fR(1) suite