| 1 | gitweb.conf(5) |
| 2 | ============== |
| 3 | |
| 4 | NAME |
| 5 | ---- |
| 6 | gitweb.conf - Gitweb (Git web interface) configuration file |
| 7 | |
| 8 | SYNOPSIS |
| 9 | -------- |
| 10 | /etc/gitweb.conf, /etc/gitweb-common.conf, $GITWEBDIR/gitweb_config.perl |
| 11 | |
| 12 | DESCRIPTION |
| 13 | ----------- |
| 14 | |
| 15 | The gitweb CGI script for viewing Git repositories over the web uses a |
| 16 | perl script fragment as its configuration file. You can set variables |
| 17 | using "`our $variable = value`"; text from a "#" character until the |
| 18 | end of a line is ignored. See *perlsyn*(1) for details. |
| 19 | |
| 20 | An example: |
| 21 | |
| 22 | ------------------------------------------------ |
| 23 | # gitweb configuration file for http://git.example.org |
| 24 | # |
| 25 | our $projectroot = "/srv/git"; # FHS recommendation |
| 26 | our $site_name = 'Example.org >> Repos'; |
| 27 | ------------------------------------------------ |
| 28 | |
| 29 | |
| 30 | The configuration file is used to override the default settings that |
| 31 | were built into gitweb at the time the 'gitweb.cgi' script was generated. |
| 32 | |
| 33 | While one could just alter the configuration settings in the gitweb |
| 34 | CGI itself, those changes would be lost upon upgrade. Configuration |
| 35 | settings might also be placed into a file in the same directory as the |
| 36 | CGI script with the default name 'gitweb_config.perl' -- allowing |
| 37 | one to have multiple gitweb instances with different configurations by |
| 38 | the use of symlinks. |
| 39 | |
| 40 | Note that some configuration can be controlled on per-repository rather than |
| 41 | gitweb-wide basis: see "Per-repository gitweb configuration" subsection on |
| 42 | linkgit:gitweb[1] manpage. |
| 43 | |
| 44 | |
| 45 | DISCUSSION |
| 46 | ---------- |
| 47 | Gitweb reads configuration data from the following sources in the |
| 48 | following order: |
| 49 | |
| 50 | * built-in values (some set during build stage), |
| 51 | |
| 52 | * common system-wide configuration file (defaults to |
| 53 | `/etc/gitweb-common.conf`), |
| 54 | |
| 55 | * either per-instance configuration file (defaults to 'gitweb_config.perl' |
| 56 | in the same directory as the installed gitweb), or if it does not exist |
| 57 | then fallback system-wide configuration file (defaults to `/etc/gitweb.conf`). |
| 58 | |
| 59 | Values obtained in later configuration files override values obtained earlier |
| 60 | in the above sequence. |
| 61 | |
| 62 | Locations of the common system-wide configuration file, the fallback |
| 63 | system-wide configuration file and the per-instance configuration file |
| 64 | are defined at compile time using build-time Makefile configuration |
| 65 | variables, respectively `GITWEB_CONFIG_COMMON`, `GITWEB_CONFIG_SYSTEM` |
| 66 | and `GITWEB_CONFIG`. |
| 67 | |
| 68 | You can also override locations of gitweb configuration files during |
| 69 | runtime by setting the following environment variables: |
| 70 | `GITWEB_CONFIG_COMMON`, `GITWEB_CONFIG_SYSTEM` and `GITWEB_CONFIG` |
| 71 | to a non-empty value. |
| 72 | |
| 73 | |
| 74 | The syntax of the configuration files is that of Perl, since these files are |
| 75 | handled by sourcing them as fragments of Perl code (the language that |
| 76 | gitweb itself is written in). Variables are typically set using the |
| 77 | `our` qualifier (as in "`our $variable = <value>;`") to avoid syntax |
| 78 | errors if a new version of gitweb no longer uses a variable and therefore |
| 79 | stops declaring it. |
| 80 | |
| 81 | You can include other configuration file using read_config_file() |
| 82 | subroutine. For example, one might want to put gitweb configuration |
| 83 | related to access control for viewing repositories via Gitolite (one |
| 84 | of Git repository management tools) in a separate file, e.g. in |
| 85 | `/etc/gitweb-gitolite.conf`. To include it, put |
| 86 | |
| 87 | -------------------------------------------------- |
| 88 | read_config_file("/etc/gitweb-gitolite.conf"); |
| 89 | -------------------------------------------------- |
| 90 | |
| 91 | somewhere in gitweb configuration file used, e.g. in per-installation |
| 92 | gitweb configuration file. Note that read_config_file() checks itself |
| 93 | that the file it reads exists, and does nothing if it is not found. |
| 94 | It also handles errors in included file. |
| 95 | |
| 96 | |
| 97 | The default configuration with no configuration file at all may work |
| 98 | perfectly well for some installations. Still, a configuration file is |
| 99 | useful for customizing or tweaking the behavior of gitweb in many ways, and |
| 100 | some optional features will not be present unless explicitly enabled using |
| 101 | the configurable `%features` variable (see also "Configuring gitweb |
| 102 | features" section below). |
| 103 | |
| 104 | |
| 105 | CONFIGURATION VARIABLES |
| 106 | ----------------------- |
| 107 | Some configuration variables have their default values (embedded in the CGI |
| 108 | script) set during building gitweb -- if that is the case, this fact is put |
| 109 | in their description. See gitweb's 'INSTALL' file for instructions on building |
| 110 | and installing gitweb. |
| 111 | |
| 112 | |
| 113 | Location of repositories |
| 114 | ~~~~~~~~~~~~~~~~~~~~~~~~ |
| 115 | The configuration variables described below control how gitweb finds |
| 116 | Git repositories, and how repositories are displayed and accessed. |
| 117 | |
| 118 | See also "Repositories" and later subsections in linkgit:gitweb[1] manpage. |
| 119 | |
| 120 | $projectroot:: |
| 121 | Absolute filesystem path which will be prepended to project path; |
| 122 | the path to repository is `$projectroot/$project`. Set to |
| 123 | `$GITWEB_PROJECTROOT` during installation. This variable has to be |
| 124 | set correctly for gitweb to find repositories. |
| 125 | + |
| 126 | For example, if `$projectroot` is set to "/srv/git" by putting the following |
| 127 | in gitweb config file: |
| 128 | + |
| 129 | ---------------------------------------------------------------------------- |
| 130 | our $projectroot = "/srv/git"; |
| 131 | ---------------------------------------------------------------------------- |
| 132 | + |
| 133 | then |
| 134 | + |
| 135 | ------------------------------------------------ |
| 136 | http://git.example.com/gitweb.cgi?p=foo/bar.git |
| 137 | ------------------------------------------------ |
| 138 | + |
| 139 | and its path_info based equivalent |
| 140 | + |
| 141 | ------------------------------------------------ |
| 142 | http://git.example.com/gitweb.cgi/foo/bar.git |
| 143 | ------------------------------------------------ |
| 144 | + |
| 145 | will map to the path `/srv/git/foo/bar.git` on the filesystem. |
| 146 | |
| 147 | $projects_list:: |
| 148 | Name of a plain text file listing projects, or a name of directory |
| 149 | to be scanned for projects. |
| 150 | + |
| 151 | Project list files should list one project per line, with each line |
| 152 | having the following format |
| 153 | + |
| 154 | ----------------------------------------------------------------------------- |
| 155 | <URI-encoded filesystem path to repository> SP <URI-encoded repository owner> |
| 156 | ----------------------------------------------------------------------------- |
| 157 | + |
| 158 | The default value of this variable is determined by the `GITWEB_LIST` |
| 159 | makefile variable at installation time. If this variable is empty, gitweb |
| 160 | will fall back to scanning the `$projectroot` directory for repositories. |
| 161 | |
| 162 | $project_maxdepth:: |
| 163 | If `$projects_list` variable is unset, gitweb will recursively |
| 164 | scan filesystem for Git repositories. The `$project_maxdepth` |
| 165 | is used to limit traversing depth, relative to `$projectroot` |
| 166 | (starting point); it means that directories which are further |
| 167 | from `$projectroot` than `$project_maxdepth` will be skipped. |
| 168 | + |
| 169 | It is purely performance optimization, originally intended for MacOS X, |
| 170 | where recursive directory traversal is slow. Gitweb follows symbolic |
| 171 | links, but it detects cycles, ignoring any duplicate files and directories. |
| 172 | + |
| 173 | The default value of this variable is determined by the build-time |
| 174 | configuration variable `GITWEB_PROJECT_MAXDEPTH`, which defaults to |
| 175 | 2007. |
| 176 | |
| 177 | $export_ok:: |
| 178 | Show repository only if this file exists (in repository). Only |
| 179 | effective if this variable evaluates to true. Can be set when |
| 180 | building gitweb by setting `GITWEB_EXPORT_OK`. This path is |
| 181 | relative to `GIT_DIR`. linkgit:git-daemon[1] uses 'git-daemon-export-ok', |
| 182 | unless started with `--export-all`. By default this variable is |
| 183 | not set, which means that this feature is turned off. |
| 184 | |
| 185 | $export_auth_hook:: |
| 186 | Function used to determine which repositories should be shown. |
| 187 | This subroutine should take one parameter, the full path to |
| 188 | a project, and if it returns true, that project will be included |
| 189 | in the projects list and can be accessed through gitweb as long |
| 190 | as it fulfills the other requirements described by $export_ok, |
| 191 | $projects_list, and $projects_maxdepth. Example: |
| 192 | + |
| 193 | ---------------------------------------------------------------------------- |
| 194 | our $export_auth_hook = sub { return -e "$_[0]/git-daemon-export-ok"; }; |
| 195 | ---------------------------------------------------------------------------- |
| 196 | + |
| 197 | though the above might be done by using `$export_ok` instead |
| 198 | + |
| 199 | ---------------------------------------------------------------------------- |
| 200 | our $export_ok = "git-daemon-export-ok"; |
| 201 | ---------------------------------------------------------------------------- |
| 202 | + |
| 203 | If not set (default), it means that this feature is disabled. |
| 204 | + |
| 205 | See also more involved example in "Controlling access to Git repositories" |
| 206 | subsection on linkgit:gitweb[1] manpage. |
| 207 | |
| 208 | $strict_export:: |
| 209 | Only allow viewing of repositories also shown on the overview page. |
| 210 | This for example makes `$export_ok` file decide if repository is |
| 211 | available and not only if it is shown. If `$projects_list` points to |
| 212 | file with list of project, only those repositories listed would be |
| 213 | available for gitweb. Can be set during building gitweb via |
| 214 | `GITWEB_STRICT_EXPORT`. By default this variable is not set, which |
| 215 | means that you can directly access those repositories that are hidden |
| 216 | from projects list page (e.g. the are not listed in the $projects_list |
| 217 | file). |
| 218 | |
| 219 | |
| 220 | Finding files |
| 221 | ~~~~~~~~~~~~~ |
| 222 | The following configuration variables tell gitweb where to find files. |
| 223 | The values of these variables are paths on the filesystem. |
| 224 | |
| 225 | $GIT:: |
| 226 | Core git executable to use. By default set to `$GIT_BINDIR/git`, which |
| 227 | in turn is by default set to `$(bindir)/git`. If you use Git installed |
| 228 | from a binary package, you should usually set this to "/usr/bin/git". |
| 229 | This can just be "git" if your web server has a sensible PATH; from |
| 230 | security point of view it is better to use absolute path to git binary. |
| 231 | If you have multiple Git versions installed it can be used to choose |
| 232 | which one to use. Must be (correctly) set for gitweb to be able to |
| 233 | work. |
| 234 | |
| 235 | $mimetypes_file:: |
| 236 | File to use for (filename extension based) guessing of MIME types before |
| 237 | trying `/etc/mime.types`. *NOTE* that this path, if relative, is taken |
| 238 | as relative to the current Git repository, not to CGI script. If unset, |
| 239 | only `/etc/mime.types` is used (if present on filesystem). If no mimetypes |
| 240 | file is found, mimetype guessing based on extension of file is disabled. |
| 241 | Unset by default. |
| 242 | |
| 243 | $highlight_bin:: |
| 244 | Path to the highlight executable to use (it must be the one from |
| 245 | http://andre-simon.de/zip/download.php[] due to assumptions about parameters and output). |
| 246 | By default set to 'highlight'; set it to full path to highlight |
| 247 | executable if it is not installed on your web server's PATH. |
| 248 | Note that 'highlight' feature must be set for gitweb to actually |
| 249 | use syntax highlighting. |
| 250 | + |
| 251 | *NOTE*: for a file to be highlighted, its syntax type must be detected |
| 252 | and that syntax must be supported by "highlight". The default syntax |
| 253 | detection is minimal, and there are many supported syntax types with no |
| 254 | detection by default. There are three options for adding syntax |
| 255 | detection. The first and second priority are `%highlight_basename` and |
| 256 | `%highlight_ext`, which detect based on basename (the full filename, for |
| 257 | example "Makefile") and extension (for example "sh"). The keys of these |
| 258 | hashes are the basename and extension, respectively, and the value for a |
| 259 | given key is the name of the syntax to be passed via `--syntax <syntax>` |
| 260 | to "highlight". The last priority is the "highlight" configuration of |
| 261 | `Shebang` regular expressions to detect the language based on the first |
| 262 | line in the file, (for example, matching the line "#!/bin/bash"). See |
| 263 | the highlight documentation and the default config at |
| 264 | /etc/highlight/filetypes.conf for more details. |
| 265 | + |
| 266 | For example if repositories you are hosting use "phtml" extension for |
| 267 | PHP files, and you want to have correct syntax-highlighting for those |
| 268 | files, you can add the following to gitweb configuration: |
| 269 | + |
| 270 | --------------------------------------------------------- |
| 271 | our %highlight_ext; |
| 272 | $highlight_ext{'phtml'} = 'php'; |
| 273 | --------------------------------------------------------- |
| 274 | |
| 275 | |
| 276 | Links and their targets |
| 277 | ~~~~~~~~~~~~~~~~~~~~~~~ |
| 278 | The configuration variables described below configure some of gitweb links: |
| 279 | their target and their look (text or image), and where to find page |
| 280 | prerequisites (stylesheet, favicon, images, scripts). Usually they are left |
| 281 | at their default values, with the possible exception of `@stylesheets` |
| 282 | variable. |
| 283 | |
| 284 | @stylesheets:: |
| 285 | List of URIs of stylesheets (relative to the base URI of a page). You |
| 286 | might specify more than one stylesheet, for example to use "gitweb.css" |
| 287 | as base with site specific modifications in a separate stylesheet |
| 288 | to make it easier to upgrade gitweb. For example, you can add |
| 289 | a `site` stylesheet by putting |
| 290 | + |
| 291 | ---------------------------------------------------------------------------- |
| 292 | push @stylesheets, "gitweb-site.css"; |
| 293 | ---------------------------------------------------------------------------- |
| 294 | + |
| 295 | in the gitweb config file. Those values that are relative paths are |
| 296 | relative to base URI of gitweb. |
| 297 | + |
| 298 | This list should contain the URI of gitweb's standard stylesheet. The default |
| 299 | URI of gitweb stylesheet can be set at build time using the `GITWEB_CSS` |
| 300 | makefile variable. Its default value is `static/gitweb.css` |
| 301 | (or `static/gitweb.min.css` if the `CSSMIN` variable is defined, |
| 302 | i.e. if CSS minifier is used during build). |
| 303 | + |
| 304 | *Note*: there is also a legacy `$stylesheet` configuration variable, which was |
| 305 | used by older gitweb. If `$stylesheet` variable is defined, only CSS stylesheet |
| 306 | given by this variable is used by gitweb. |
| 307 | |
| 308 | $logo:: |
| 309 | Points to the location where you put 'git-logo.png' on your web |
| 310 | server, or to be more the generic URI of logo, 72x27 size). This image |
| 311 | is displayed in the top right corner of each gitweb page and used as |
| 312 | a logo for the Atom feed. Relative to the base URI of gitweb (as a path). |
| 313 | Can be adjusted when building gitweb using `GITWEB_LOGO` variable |
| 314 | By default set to `static/git-logo.png`. |
| 315 | |
| 316 | $favicon:: |
| 317 | Points to the location where you put 'git-favicon.png' on your web |
| 318 | server, or to be more the generic URI of favicon, which will be served |
| 319 | as "image/png" type. Web browsers that support favicons (website icons) |
| 320 | may display them in the browser's URL bar and next to the site name in |
| 321 | bookmarks. Relative to the base URI of gitweb. Can be adjusted at |
| 322 | build time using `GITWEB_FAVICON` variable. |
| 323 | By default set to `static/git-favicon.png`. |
| 324 | |
| 325 | $javascript:: |
| 326 | Points to the location where you put 'gitweb.js' on your web server, |
| 327 | or to be more generic the URI of JavaScript code used by gitweb. |
| 328 | Relative to the base URI of gitweb. Can be set at build time using |
| 329 | the `GITWEB_JS` build-time configuration variable. |
| 330 | + |
| 331 | The default value is either `static/gitweb.js`, or `static/gitweb.min.js` if |
| 332 | the `JSMIN` build variable was defined, i.e. if JavaScript minifier was used |
| 333 | at build time. *Note* that this single file is generated from multiple |
| 334 | individual JavaScript "modules". |
| 335 | |
| 336 | $home_link:: |
| 337 | Target of the home link on the top of all pages (the first part of view |
| 338 | "breadcrumbs"). By default it is set to the absolute URI of a current page |
| 339 | (to the value of `$my_uri` variable, or to "/" if `$my_uri` is undefined |
| 340 | or is an empty string). |
| 341 | |
| 342 | $home_link_str:: |
| 343 | Label for the "home link" at the top of all pages, leading to `$home_link` |
| 344 | (usually the main gitweb page, which contains the projects list). It is |
| 345 | used as the first component of gitweb's "breadcrumb trail": |
| 346 | `<home-link> / <project> / <action>`. Can be set at build time using |
| 347 | the `GITWEB_HOME_LINK_STR` variable. By default it is set to "projects", |
| 348 | as this link leads to the list of projects. Another popular choice is to |
| 349 | set it to the name of site. Note that it is treated as raw HTML so it |
| 350 | should not be set from untrusted sources. |
| 351 | |
| 352 | @extra_breadcrumbs:: |
| 353 | Additional links to be added to the start of the breadcrumb trail before |
| 354 | the home link, to pages that are logically "above" the gitweb projects |
| 355 | list, such as the organization and department which host the gitweb |
| 356 | server. Each element of the list is a reference to an array, in which |
| 357 | element 0 is the link text (equivalent to `$home_link_str`) and element |
| 358 | 1 is the target URL (equivalent to `$home_link`). |
| 359 | + |
| 360 | For example, the following setting produces a breadcrumb trail like |
| 361 | "home / dev / projects / ..." where "projects" is the home link. |
| 362 | + |
| 363 | ---------------------------------------------------------------------------- |
| 364 | our @extra_breadcrumbs = ( |
| 365 | [ 'home' => 'https://www.example.org/' ], |
| 366 | [ 'dev' => 'https://dev.example.org/' ], |
| 367 | ); |
| 368 | ---------------------------------------------------------------------------- |
| 369 | |
| 370 | $logo_url:: |
| 371 | $logo_label:: |
| 372 | URI and label (title) for the Git logo link (or your site logo, |
| 373 | if you chose to use different logo image). By default, these both |
| 374 | refer to Git homepage, https://git-scm.com[]; in the past, they pointed |
| 375 | to Git documentation at https://www.kernel.org[]. |
| 376 | |
| 377 | |
| 378 | Changing gitweb's look |
| 379 | ~~~~~~~~~~~~~~~~~~~~~~ |
| 380 | You can adjust how pages generated by gitweb look using the variables described |
| 381 | below. You can change the site name, add common headers and footers for all |
| 382 | pages, and add a description of this gitweb installation on its main page |
| 383 | (which is the projects list page), etc. |
| 384 | |
| 385 | $site_name:: |
| 386 | Name of your site or organization, to appear in page titles. Set it |
| 387 | to something descriptive for clearer bookmarks etc. If this variable |
| 388 | is not set or is, then gitweb uses the value of the `SERVER_NAME` |
| 389 | `CGI` environment variable, setting site name to "$SERVER_NAME Git", |
| 390 | or "Untitled Git" if this variable is not set (e.g. if running gitweb |
| 391 | as standalone script). |
| 392 | + |
| 393 | Can be set using the `GITWEB_SITENAME` at build time. Unset by default. |
| 394 | |
| 395 | $site_html_head_string:: |
| 396 | HTML snippet to be included in the <head> section of each page. |
| 397 | Can be set using `GITWEB_SITE_HTML_HEAD_STRING` at build time. |
| 398 | No default value. |
| 399 | |
| 400 | $site_header:: |
| 401 | Name of a file with HTML to be included at the top of each page. |
| 402 | Relative to the directory containing the 'gitweb.cgi' script. |
| 403 | Can be set using `GITWEB_SITE_HEADER` at build time. No default |
| 404 | value. |
| 405 | |
| 406 | $site_footer:: |
| 407 | Name of a file with HTML to be included at the bottom of each page. |
| 408 | Relative to the directory containing the 'gitweb.cgi' script. |
| 409 | Can be set using `GITWEB_SITE_FOOTER` at build time. No default |
| 410 | value. |
| 411 | |
| 412 | $home_text:: |
| 413 | Name of a HTML file which, if it exists, is included on the |
| 414 | gitweb projects overview page ("projects_list" view). Relative to |
| 415 | the directory containing the gitweb.cgi script. Default value |
| 416 | can be adjusted during build time using `GITWEB_HOMETEXT` variable. |
| 417 | By default set to 'indextext.html'. |
| 418 | |
| 419 | $projects_list_description_width:: |
| 420 | The width (in characters) of the "Description" column of the projects list. |
| 421 | Longer descriptions will be truncated (trying to cut at word boundary); |
| 422 | the full description is available in the 'title' attribute (usually shown on |
| 423 | mouseover). The default is 25, which might be too small if you |
| 424 | use long project descriptions. |
| 425 | |
| 426 | $default_projects_order:: |
| 427 | Default value of ordering of projects on projects list page, which |
| 428 | means the ordering used if you don't explicitly sort projects list |
| 429 | (if there is no "o" CGI query parameter in the URL). Valid values |
| 430 | are "none" (unsorted), "project" (projects are by project name, |
| 431 | i.e. path to repository relative to `$projectroot`), "descr" |
| 432 | (project description), "owner", and "age" (by date of most current |
| 433 | commit). |
| 434 | + |
| 435 | Default value is "project". Unknown value means unsorted. |
| 436 | |
| 437 | |
| 438 | Changing gitweb's behavior |
| 439 | ~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 440 | These configuration variables control _internal_ gitweb behavior. |
| 441 | |
| 442 | $default_blob_plain_mimetype:: |
| 443 | Default mimetype for the blob_plain (raw) view, if mimetype checking |
| 444 | doesn't result in some other type; by default "text/plain". |
| 445 | Gitweb guesses mimetype of a file to display based on extension |
| 446 | of its filename, using `$mimetypes_file` (if set and file exists) |
| 447 | and `/etc/mime.types` files (see *mime.types*(5) manpage; only |
| 448 | filename extension rules are supported by gitweb). |
| 449 | |
| 450 | $default_text_plain_charset:: |
| 451 | Default charset for text files. If this is not set, the web server |
| 452 | configuration will be used. Unset by default. |
| 453 | |
| 454 | $fallback_encoding:: |
| 455 | Gitweb assumes this charset when a line contains non-UTF-8 characters. |
| 456 | The fallback decoding is used without error checking, so it can be even |
| 457 | "utf-8". The value must be a valid encoding; see the *Encoding::Supported*(3pm) |
| 458 | man page for a list. The default is "latin1", aka. "iso-8859-1". |
| 459 | |
| 460 | @diff_opts:: |
| 461 | Rename detection options for git-diff and git-diff-tree. The default is |
| 462 | (\'-M'); set it to (\'-C') or (\'-C', \'-C') to also detect copies, |
| 463 | or set it to () i.e. empty list if you don't want to have renames |
| 464 | detection. |
| 465 | + |
| 466 | *Note* that rename and especially copy detection can be quite |
| 467 | CPU-intensive. Note also that non Git tools can have problems with |
| 468 | patches generated with options mentioned above, especially when they |
| 469 | involve file copies (\'-C') or criss-cross renames (\'-B'). |
| 470 | |
| 471 | |
| 472 | Some optional features and policies |
| 473 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 474 | Most of features are configured via `%feature` hash; however some of extra |
| 475 | gitweb features can be turned on and configured using variables described |
| 476 | below. This list beside configuration variables that control how gitweb |
| 477 | looks does contain variables configuring administrative side of gitweb |
| 478 | (e.g. cross-site scripting prevention; admittedly this as side effect |
| 479 | affects how "summary" pages look like, or load limiting). |
| 480 | |
| 481 | @git_base_url_list:: |
| 482 | List of Git base URLs. These URLs are used to generate URLs |
| 483 | describing from where to fetch a project, which are shown on |
| 484 | project summary page. The full fetch URL is "`$git_base_url/$project`", |
| 485 | for each element of this list. You can set up multiple base URLs |
| 486 | (for example one for `git://` protocol, and one for `http://` |
| 487 | protocol). |
| 488 | + |
| 489 | Note that per repository configuration can be set in `$GIT_DIR/cloneurl` |
| 490 | file, or as values of multi-value `gitweb.url` configuration variable in |
| 491 | project config. Per-repository configuration takes precedence over value |
| 492 | composed from `@git_base_url_list` elements and project name. |
| 493 | + |
| 494 | You can setup one single value (single entry/item in this list) at build |
| 495 | time by setting the `GITWEB_BASE_URL` build-time configuration variable. |
| 496 | By default it is set to (), i.e. an empty list. This means that gitweb |
| 497 | would not try to create project URL (to fetch) from project name. |
| 498 | |
| 499 | $projects_list_group_categories:: |
| 500 | Whether to enable the grouping of projects by category on the project |
| 501 | list page. The category of a project is determined by the |
| 502 | `$GIT_DIR/category` file or the `gitweb.category` variable in each |
| 503 | repository's configuration. Disabled by default (set to 0). |
| 504 | |
| 505 | $project_list_default_category:: |
| 506 | Default category for projects for which none is specified. If this is |
| 507 | set to the empty string, such projects will remain uncategorized and |
| 508 | listed at the top, above categorized projects. Used only if project |
| 509 | categories are enabled, which means if `$projects_list_group_categories` |
| 510 | is true. By default set to "" (empty string). |
| 511 | |
| 512 | $prevent_xss:: |
| 513 | If true, some gitweb features are disabled to prevent content in |
| 514 | repositories from launching cross-site scripting (XSS) attacks. Set this |
| 515 | to true if you don't trust the content of your repositories. |
| 516 | False by default (set to 0). |
| 517 | |
| 518 | $maxload:: |
| 519 | Used to set the maximum load that we will still respond to gitweb queries. |
| 520 | If the server load exceeds this value then gitweb will return |
| 521 | "503 Service Unavailable" error. The server load is taken to be 0 |
| 522 | if gitweb cannot determine its value. Currently it works only on Linux, |
| 523 | where it uses `/proc/loadavg`; the load there is the number of active |
| 524 | tasks on the system -- processes that are actually running -- averaged |
| 525 | over the last minute. |
| 526 | + |
| 527 | Set `$maxload` to undefined value (`undef`) to turn this feature off. |
| 528 | The default value is 300. |
| 529 | |
| 530 | $omit_age_column:: |
| 531 | If true, omit the column with date of the most current commit on the |
| 532 | projects list page. It can save a bit of I/O and a fork per repository. |
| 533 | |
| 534 | $omit_owner:: |
| 535 | If true prevents displaying information about repository owner. |
| 536 | |
| 537 | $per_request_config:: |
| 538 | If this is set to code reference, it will be run once for each request. |
| 539 | You can set parts of configuration that change per session this way. |
| 540 | For example, one might use the following code in a gitweb configuration |
| 541 | file |
| 542 | + |
| 543 | -------------------------------------------------------------------------------- |
| 544 | our $per_request_config = sub { |
| 545 | $ENV{GL_USER} = $cgi->remote_user || "gitweb"; |
| 546 | }; |
| 547 | -------------------------------------------------------------------------------- |
| 548 | + |
| 549 | If `$per_request_config` is not a code reference, it is interpreted as boolean |
| 550 | value. If it is true gitweb will process config files once per request, |
| 551 | and if it is false gitweb will process config files only once, each time it |
| 552 | is executed. True by default (set to 1). |
| 553 | + |
| 554 | *NOTE*: `$my_url`, `$my_uri`, and `$base_url` are overwritten with their default |
| 555 | values before every request, so if you want to change them, be sure to set |
| 556 | this variable to true or a code reference effecting the desired changes. |
| 557 | + |
| 558 | This variable matters only when using persistent web environments that |
| 559 | serve multiple requests using single gitweb instance, like mod_perl, |
| 560 | FastCGI or Plackup. |
| 561 | |
| 562 | |
| 563 | Other variables |
| 564 | ~~~~~~~~~~~~~~~ |
| 565 | Usually you should not need to change (adjust) any of configuration |
| 566 | variables described below; they should be automatically set by gitweb to |
| 567 | correct value. |
| 568 | |
| 569 | |
| 570 | $version:: |
| 571 | Gitweb version, set automatically when creating gitweb.cgi from |
| 572 | gitweb.perl. You might want to modify it if you are running modified |
| 573 | gitweb, for example |
| 574 | + |
| 575 | --------------------------------------------------- |
| 576 | our $version .= " with caching"; |
| 577 | --------------------------------------------------- |
| 578 | + |
| 579 | if you run modified version of gitweb with caching support. This variable |
| 580 | is purely informational, used e.g. in the "generator" meta header in HTML |
| 581 | header. |
| 582 | |
| 583 | $my_url:: |
| 584 | $my_uri:: |
| 585 | Full URL and absolute URL of the gitweb script; |
| 586 | in earlier versions of gitweb you might have need to set those |
| 587 | variables, but now there should be no need to do it. See |
| 588 | `$per_request_config` if you need to set them still. |
| 589 | |
| 590 | $base_url:: |
| 591 | Base URL for relative URLs in pages generated by gitweb, |
| 592 | (e.g. `$logo`, `$favicon`, `@stylesheets` if they are relative URLs), |
| 593 | needed and used '<base href="$base_url">' only for URLs with nonempty |
| 594 | PATH_INFO. Usually gitweb sets its value correctly, |
| 595 | and there is no need to set this variable, e.g. to $my_uri or "/". |
| 596 | See `$per_request_config` if you need to override it anyway. |
| 597 | |
| 598 | |
| 599 | CONFIGURING GITWEB FEATURES |
| 600 | --------------------------- |
| 601 | Many gitweb features can be enabled (or disabled) and configured using the |
| 602 | `%feature` hash. Names of gitweb features are keys of this hash. |
| 603 | |
| 604 | Each `%feature` hash element is a hash reference and has the following |
| 605 | structure: |
| 606 | |
| 607 | ---------------------------------------------------------------------- |
| 608 | "<feature-name>" => { |
| 609 | "sub" => <feature-sub-(subroutine)>, |
| 610 | "override" => <allow-override-(boolean)>, |
| 611 | "default" => [ <options>... ] |
| 612 | }, |
| 613 | ---------------------------------------------------------------------- |
| 614 | Some features cannot be overridden per project. For those |
| 615 | features the structure of appropriate `%feature` hash element has a simpler |
| 616 | form: |
| 617 | |
| 618 | ---------------------------------------------------------------------- |
| 619 | "<feature-name>" => { |
| 620 | "override" => 0, |
| 621 | "default" => [ <options>... ] |
| 622 | }, |
| 623 | ---------------------------------------------------------------------- |
| 624 | As one can see it lacks the \'sub' element. |
| 625 | |
| 626 | The meaning of each part of feature configuration is described |
| 627 | below: |
| 628 | |
| 629 | default:: |
| 630 | List (array reference) of feature parameters (if there are any), |
| 631 | used also to toggle (enable or disable) given feature. |
| 632 | + |
| 633 | Note that it is currently *always* an array reference, even if |
| 634 | feature doesn't accept any configuration parameters, and \'default' |
| 635 | is used only to turn it on or off. In such case you turn feature on |
| 636 | by setting this element to `[1]`, and torn it off by setting it to |
| 637 | `[0]`. See also the passage about the "blame" feature in the "Examples" |
| 638 | section. |
| 639 | + |
| 640 | To disable features that accept parameters (are configurable), you |
| 641 | need to set this element to empty list i.e. `[]`. |
| 642 | |
| 643 | override:: |
| 644 | If this field has a true value then the given feature is |
| 645 | overridable, which means that it can be configured |
| 646 | (or enabled/disabled) on a per-repository basis. |
| 647 | + |
| 648 | Usually given "<feature>" is configurable via the `gitweb.<feature>` |
| 649 | config variable in the per-repository Git configuration file. |
| 650 | + |
| 651 | *Note* that no feature is overridable by default. |
| 652 | |
| 653 | sub:: |
| 654 | Internal detail of implementation. What is important is that |
| 655 | if this field is not present then per-repository override for |
| 656 | given feature is not supported. |
| 657 | + |
| 658 | You wouldn't need to ever change it in gitweb config file. |
| 659 | |
| 660 | |
| 661 | Features in `%feature` |
| 662 | ~~~~~~~~~~~~~~~~~~~~~~ |
| 663 | The gitweb features that are configurable via `%feature` hash are listed |
| 664 | below. This should be a complete list, but ultimately the authoritative |
| 665 | and complete list is in gitweb.cgi source code, with features described |
| 666 | in the comments. |
| 667 | |
| 668 | blame:: |
| 669 | Enable the "blame" and "blame_incremental" blob views, showing for |
| 670 | each line the last commit that modified it; see linkgit:git-blame[1]. |
| 671 | This can be very CPU-intensive and is therefore disabled by default. |
| 672 | + |
| 673 | This feature can be configured on a per-repository basis via |
| 674 | repository's `gitweb.blame` configuration variable (boolean). |
| 675 | |
| 676 | snapshot:: |
| 677 | Enable and configure the "snapshot" action, which allows user to |
| 678 | download a compressed archive of any tree or commit, as produced |
| 679 | by linkgit:git-archive[1] and possibly additionally compressed. |
| 680 | This can potentially generate high traffic if you have large project. |
| 681 | + |
| 682 | The value of \'default' is a list of names of snapshot formats, |
| 683 | defined in `%known_snapshot_formats` hash, that you wish to offer. |
| 684 | Supported formats include "tgz", "tbz2", "txz" (gzip/bzip2/xz |
| 685 | compressed tar archive) and "zip"; please consult gitweb sources for |
| 686 | a definitive list. By default only "tgz" is offered. |
| 687 | + |
| 688 | This feature can be configured on a per-repository basis via |
| 689 | repository's `gitweb.snapshot` configuration variable, which contains |
| 690 | a comma separated list of formats or "none" to disable snapshots. |
| 691 | Unknown values are ignored. |
| 692 | |
| 693 | grep:: |
| 694 | Enable grep search, which lists the files in currently selected |
| 695 | tree (directory) containing the given string; see linkgit:git-grep[1]. |
| 696 | This can be potentially CPU-intensive, of course. Enabled by default. |
| 697 | + |
| 698 | This feature can be configured on a per-repository basis via |
| 699 | repository's `gitweb.grep` configuration variable (boolean). |
| 700 | |
| 701 | pickaxe:: |
| 702 | Enable the so called pickaxe search, which will list the commits |
| 703 | that introduced or removed a given string in a file. This can be |
| 704 | practical and quite faster alternative to "blame" action, but it is |
| 705 | still potentially CPU-intensive. Enabled by default. |
| 706 | + |
| 707 | The pickaxe search is described in linkgit:git-log[1] (the |
| 708 | description of `-S<string>` option, which refers to pickaxe entry in |
| 709 | linkgit:gitdiffcore[7] for more details). |
| 710 | + |
| 711 | This feature can be configured on a per-repository basis by setting |
| 712 | repository's `gitweb.pickaxe` configuration variable (boolean). |
| 713 | |
| 714 | show-sizes:: |
| 715 | Enable showing size of blobs (ordinary files) in a "tree" view, in a |
| 716 | separate column, similar to what `ls -l` does; see description of |
| 717 | `-l` option in linkgit:git-ls-tree[1] manpage. This costs a bit of |
| 718 | I/O. Enabled by default. |
| 719 | + |
| 720 | This feature can be configured on a per-repository basis via |
| 721 | repository's `gitweb.showSizes` configuration variable (boolean). |
| 722 | |
| 723 | patches:: |
| 724 | Enable and configure "patches" view, which displays list of commits in email |
| 725 | (plain text) output format; see also linkgit:git-format-patch[1]. |
| 726 | The value is the maximum number of patches in a patchset generated |
| 727 | in "patches" view. Set the 'default' field to a list containing single |
| 728 | item of or to an empty list to disable patch view, or to a list |
| 729 | containing a single negative number to remove any limit. |
| 730 | Default value is 16. |
| 731 | + |
| 732 | This feature can be configured on a per-repository basis via |
| 733 | repository's `gitweb.patches` configuration variable (integer). |
| 734 | |
| 735 | avatar:: |
| 736 | Avatar support. When this feature is enabled, views such as |
| 737 | "shortlog" or "commit" will display an avatar associated with |
| 738 | the email of each committer and author. |
| 739 | + |
| 740 | Currently available providers are *"gravatar"* and *"picon"*. |
| 741 | Only one provider at a time can be selected ('default' is one element list). |
| 742 | If an unknown provider is specified, the feature is disabled. |
| 743 | *Note* that some providers might require extra Perl packages to be |
| 744 | installed; see `gitweb/INSTALL` for more details. |
| 745 | + |
| 746 | This feature can be configured on a per-repository basis via |
| 747 | repository's `gitweb.avatar` configuration variable. |
| 748 | + |
| 749 | See also `%avatar_size` with pixel sizes for icons and avatars |
| 750 | ("default" is used for one-line like "log" and "shortlog", "double" |
| 751 | is used for two-line like "commit", "commitdiff" or "tag"). If the |
| 752 | default font sizes or lineheights are changed (e.g. via adding extra |
| 753 | CSS stylesheet in `@stylesheets`), it may be appropriate to change |
| 754 | these values. |
| 755 | |
| 756 | email-privacy:: |
| 757 | Redact e-mail addresses from the generated HTML, etc. content. |
| 758 | This obscures e-mail addresses retrieved from the author/committer |
| 759 | and comment sections of the Git log. |
| 760 | It is meant to hinder web crawlers that harvest and abuse addresses. |
| 761 | Such crawlers may not respect robots.txt. |
| 762 | Note that users and user tools also see the addresses as redacted. |
| 763 | If Gitweb is not the final step in a workflow then subsequent steps |
| 764 | may misbehave because of the redacted information they receive. |
| 765 | Disabled by default. |
| 766 | |
| 767 | highlight:: |
| 768 | Server-side syntax highlight support in "blob" view. It requires |
| 769 | `$highlight_bin` program to be available (see the description of |
| 770 | this variable in the "Configuration variables" section above), |
| 771 | and therefore is disabled by default. |
| 772 | + |
| 773 | This feature can be configured on a per-repository basis via |
| 774 | repository's `gitweb.highlight` configuration variable (boolean). |
| 775 | |
| 776 | remote_heads:: |
| 777 | Enable displaying remote heads (remote-tracking branches) in the "heads" |
| 778 | list. In most cases the list of remote-tracking branches is an |
| 779 | unnecessary internal private detail, and this feature is therefore |
| 780 | disabled by default. linkgit:git-instaweb[1], which is usually used |
| 781 | to browse local repositories, enables and uses this feature. |
| 782 | + |
| 783 | This feature can be configured on a per-repository basis via |
| 784 | repository's `gitweb.remote_heads` configuration variable (boolean). |
| 785 | |
| 786 | |
| 787 | The remaining features cannot be overridden on a per project basis. |
| 788 | |
| 789 | search:: |
| 790 | Enable text search, which will list the commits which match author, |
| 791 | committer or commit text to a given string; see the description of |
| 792 | `--author`, `--committer` and `--grep` options in linkgit:git-log[1] |
| 793 | manpage. Enabled by default. |
| 794 | + |
| 795 | Project specific override is not supported. |
| 796 | |
| 797 | forks:: |
| 798 | If this feature is enabled, gitweb considers projects in |
| 799 | subdirectories of project root (basename) to be forks of existing |
| 800 | projects. For each project +$projname.git+, projects in the |
| 801 | +$projname/+ directory and its subdirectories will not be |
| 802 | shown in the main projects list. Instead, a \'+' mark is shown |
| 803 | next to `$projname`, which links to a "forks" view that lists all |
| 804 | the forks (all projects in `$projname/` subdirectory). Additionally |
| 805 | a "forks" view for a project is linked from project summary page. |
| 806 | + |
| 807 | If the project list is taken from a file (+$projects_list+ points to a |
| 808 | file), forks are only recognized if they are listed after the main project |
| 809 | in that file. |
| 810 | + |
| 811 | Project specific override is not supported. |
| 812 | |
| 813 | actions:: |
| 814 | Insert custom links to the action bar of all project pages. This |
| 815 | allows you to link to third-party scripts integrating into gitweb. |
| 816 | + |
| 817 | The "default" value consists of a list of triplets in the form |
| 818 | `("<label>", "<link>", "<position>")` where "position" is the label |
| 819 | after which to insert the link, "link" is a format string where `%n` |
| 820 | expands to the project name, `%f` to the project path within the |
| 821 | filesystem (i.e. "$projectroot/$project"), `%h` to the current hash |
| 822 | (\'h' gitweb parameter) and `%b` to the current hash base |
| 823 | (\'hb' gitweb parameter); `%%` expands to \'%'. |
| 824 | + |
| 825 | For example, at the time this page was written, the https://repo.or.cz[] |
| 826 | Git hosting site set it to the following to enable graphical log |
| 827 | (using the third party tool *git-browser*): |
| 828 | + |
| 829 | ---------------------------------------------------------------------- |
| 830 | $feature{'actions'}{'default'} = |
| 831 | [ ('graphiclog', '/git-browser/by-commit.html?r=%n', 'summary')]; |
| 832 | ---------------------------------------------------------------------- |
| 833 | + |
| 834 | This adds a link titled "graphiclog" after the "summary" link, leading to |
| 835 | `git-browser` script, passing `r=<project>` as a query parameter. |
| 836 | + |
| 837 | Project specific override is not supported. |
| 838 | |
| 839 | timed:: |
| 840 | Enable displaying how much time and how many Git commands it took to |
| 841 | generate and display each page in the page footer (at the bottom of |
| 842 | page). For example the footer might contain: "This page took 6.53325 |
| 843 | seconds and 13 Git commands to generate." Disabled by default. |
| 844 | + |
| 845 | Project specific override is not supported. |
| 846 | |
| 847 | javascript-timezone:: |
| 848 | Enable and configure the ability to change a common time zone for dates |
| 849 | in gitweb output via JavaScript. Dates in gitweb output include |
| 850 | authordate and committerdate in "commit", "commitdiff" and "log" |
| 851 | views, and taggerdate in "tag" view. Enabled by default. |
| 852 | + |
| 853 | The value is a list of three values: a default time zone (for if the client |
| 854 | hasn't selected some other time zone and saved it in a cookie), a name of cookie |
| 855 | where to store selected time zone, and a CSS class used to mark up |
| 856 | dates for manipulation. If you want to turn this feature off, set "default" |
| 857 | to empty list: `[]`. |
| 858 | + |
| 859 | Typical gitweb config files will only change starting (default) time zone, |
| 860 | and leave other elements at their default values: |
| 861 | + |
| 862 | --------------------------------------------------------------------------- |
| 863 | $feature{'javascript-timezone'}{'default'}[0] = "utc"; |
| 864 | --------------------------------------------------------------------------- |
| 865 | + |
| 866 | The example configuration presented here is guaranteed to be backwards |
| 867 | and forward compatible. |
| 868 | + |
| 869 | Time zone values can be "local" (for local time zone that browser uses), "utc" |
| 870 | (what gitweb uses when JavaScript or this feature is disabled), or numerical |
| 871 | time zones in the form of "+/-HHMM", such as "+0200". |
| 872 | + |
| 873 | Project specific override is not supported. |
| 874 | |
| 875 | extra-branch-refs:: |
| 876 | List of additional directories under "refs" which are going to |
| 877 | be used as branch refs. For example if you have a gerrit setup |
| 878 | where all branches under refs/heads/ are official, |
| 879 | push-after-review ones and branches under refs/sandbox/, |
| 880 | refs/wip and refs/other are user ones where permissions are |
| 881 | much wider, then you might want to set this variable as |
| 882 | follows: |
| 883 | + |
| 884 | -------------------------------------------------------------------------------- |
| 885 | $feature{'extra-branch-refs'}{'default'} = |
| 886 | ['sandbox', 'wip', 'other']; |
| 887 | -------------------------------------------------------------------------------- |
| 888 | + |
| 889 | This feature can be configured on per-repository basis after setting |
| 890 | $feature{'extra-branch-refs'}{'override'} to true, via repository's |
| 891 | `gitweb.extraBranchRefs` configuration variable, which contains a |
| 892 | space separated list of refs. An example: |
| 893 | + |
| 894 | -------------------------------------------------------------------------------- |
| 895 | [gitweb] |
| 896 | extraBranchRefs = sandbox wip other |
| 897 | -------------------------------------------------------------------------------- |
| 898 | + |
| 899 | The gitweb.extraBranchRefs is actually a multi-valued configuration |
| 900 | variable, so following example is also correct and the result is the |
| 901 | same as of the snippet above: |
| 902 | + |
| 903 | -------------------------------------------------------------------------------- |
| 904 | [gitweb] |
| 905 | extraBranchRefs = sandbox |
| 906 | extraBranchRefs = wip other |
| 907 | -------------------------------------------------------------------------------- |
| 908 | + |
| 909 | It is an error to specify a ref that does not pass "git check-ref-format" |
| 910 | scrutiny. Duplicated values are filtered. |
| 911 | |
| 912 | |
| 913 | EXAMPLES |
| 914 | -------- |
| 915 | |
| 916 | To enable blame, pickaxe search, and snapshot support (allowing "tar.gz" and |
| 917 | "zip" snapshots), while allowing individual projects to turn them off, put |
| 918 | the following in your GITWEB_CONFIG file: |
| 919 | |
| 920 | -------------------------------------------------------------------------------- |
| 921 | $feature{'blame'}{'default'} = [1]; |
| 922 | $feature{'blame'}{'override'} = 1; |
| 923 | |
| 924 | $feature{'pickaxe'}{'default'} = [1]; |
| 925 | $feature{'pickaxe'}{'override'} = 1; |
| 926 | |
| 927 | $feature{'snapshot'}{'default'} = ['zip', 'tgz']; |
| 928 | $feature{'snapshot'}{'override'} = 1; |
| 929 | -------------------------------------------------------------------------------- |
| 930 | |
| 931 | If you allow overriding for the snapshot feature, you can specify which |
| 932 | snapshot formats are globally disabled. You can also add any command-line |
| 933 | options you want (such as setting the compression level). For instance, you |
| 934 | can disable Zip compressed snapshots and set *gzip*(1) to run at level 6 by |
| 935 | adding the following lines to your gitweb configuration file: |
| 936 | |
| 937 | $known_snapshot_formats{'zip'}{'disabled'} = 1; |
| 938 | $known_snapshot_formats{'tgz'}{'compressor'} = ['gzip','-6']; |
| 939 | |
| 940 | BUGS |
| 941 | ---- |
| 942 | Debugging would be easier if the fallback configuration file |
| 943 | (`/etc/gitweb.conf`) and environment variable to override its location |
| 944 | ('GITWEB_CONFIG_SYSTEM') had names reflecting their "fallback" role. |
| 945 | The current names are kept to avoid breaking working setups. |
| 946 | |
| 947 | ENVIRONMENT |
| 948 | ----------- |
| 949 | The location of per-instance and system-wide configuration files can be |
| 950 | overridden using the following environment variables: |
| 951 | |
| 952 | GITWEB_CONFIG:: |
| 953 | Sets location of per-instance configuration file. |
| 954 | GITWEB_CONFIG_SYSTEM:: |
| 955 | Sets location of fallback system-wide configuration file. |
| 956 | This file is read only if per-instance one does not exist. |
| 957 | GITWEB_CONFIG_COMMON:: |
| 958 | Sets location of common system-wide configuration file. |
| 959 | |
| 960 | |
| 961 | FILES |
| 962 | ----- |
| 963 | gitweb_config.perl:: |
| 964 | This is default name of per-instance configuration file. The |
| 965 | format of this file is described above. |
| 966 | /etc/gitweb.conf:: |
| 967 | This is default name of fallback system-wide configuration |
| 968 | file. This file is used only if per-instance configuration |
| 969 | variable is not found. |
| 970 | /etc/gitweb-common.conf:: |
| 971 | This is default name of common system-wide configuration |
| 972 | file. |
| 973 | |
| 974 | |
| 975 | SEE ALSO |
| 976 | -------- |
| 977 | linkgit:gitweb[1], linkgit:git-instaweb[1] |
| 978 | |
| 979 | 'gitweb/README', 'gitweb/INSTALL' |
| 980 | |
| 981 | GIT |
| 982 | --- |
| 983 | Part of the linkgit:git[1] suite |