10 cgitrc - runtime configuration for cgit
15 Cgitrc contains all runtime settings for cgit, including the list of git
16 repositories, formatted as a line-separated list of NAME=VALUE pairs. Blank
17 lines, and lines starting with '#', are ignored.
22 The default location of cgitrc, defined at compile time, is /etc/cgitrc. At
23 runtime, cgit will consult the environment variable CGIT_CONFIG and, if
24 defined, use its value instead.
30 Specifies a command which will be invoked to format the content of
31 about pages (both top-level and for each repository). The command will
32 get the content of the about-file on its STDIN, the name of the file
33 as the first argument, and the STDOUT from the command will be
34 included verbatim on the about page. Default value: none. See
38 Specifies a path, relative to each repository path, which can be used
39 to specify the date and time of the youngest commit in the repository.
40 The first line in the file is used as input to the "parse_date"
41 function in libgit. Recommended timestamp-format is "yyyy-mm-dd
42 hh:mm:ss". Default value: "info/web/last-modified".
45 Flag which, when set to "age", enables date ordering in the branch ref
46 list, and when set to "name" enables ordering by branch name. Default
50 Path used to store the cgit cache entries. Default value:
51 "/var/cache/cgit". See also: "MACRO EXPANSION".
54 Number which specifies the time-to-live, in minutes, for the cached
55 version of repository pages accessed with a fixed SHA1. Negative
56 values have infinite ttl. Default value: -1".
59 Number which specifies the time-to-live, in minutes, for the cached
60 version of repository pages accessed without a fixed SHA1. Negative
61 values have infinite ttl. Default value: "5".
64 Number which specifies the time-to-live, in minutes, for the cached
65 version of the repository summary page. Negative values have infinite
66 ttl. Default value: "5".
69 Number which specifies the time-to-live, in minutes, for the cached
70 version of the repository index page. Negative values have infinite
71 ttl. Default value: "5".
74 Number which specifies the time-to-live, in minutes, for the result
75 of scanning a path for git repositories. Negative values have infinite
76 ttl. Default value: "15".
79 Number which specifies the time-to-live, in minutes, for the cached
80 version of the repository about page. Negative values have infinite
81 ttl. Default value: "15".
84 The maximum number of entries in the cgit cache. Default value: "0"
85 (i.e. caching is disabled).
88 Sort items in the repo list case sensitively. Default value: "1".
89 See also: repository-sort, section-sort.
92 Space-separated list of common prefixes which, when combined with a
93 repository url, generates valid clone urls for the repository. This
94 setting is only used if `repo.clone-url` is unspecified. Default value:
98 Space-separated list of clone-url templates. This setting is only
99 used if `repo.clone-url` is unspecified. Default value: none. See
100 also: "MACRO EXPANSION", "FILTER API".
103 Specifies a command which will be invoked to format commit messages.
104 The command will get the message on its STDIN, and the STDOUT from the
105 command will be included verbatim as the commit message, i.e. this can
106 be used to implement bugtracker integration. Default value: none.
107 See also: "FILTER API".
110 Flag which, when set to "date", enables strict date ordering in the
111 commit log, and when set to "topo" enables strict topological
112 ordering. If unset, the default ordering of "git log" is used. Default
116 Url which specifies the css document to include in all cgit pages.
117 Default value: "/cgit.css".
120 Flag which, when set to "1", will make cgit generate a html fragment
121 suitable for embedding in other html pages. Default value: none. See
124 enable-commit-graph::
125 Flag which, when set to "1", will make cgit print an ASCII-art commit
126 history graph to the left of the commit messages in the repository
127 log page. Default value: "0".
129 enable-filter-overrides::
130 Flag which, when set to "1", allows all filter settings to be
131 overridden in repository-specific cgitrc files. Default value: none.
134 If set to "1", cgit will act as an dumb HTTP endpoint for git clones.
135 If you use an alternate way of serving git repositories, you may wish
136 to disable this. Default value: "1".
139 Flag which, when set to "1", will make cgit generate extra links for
140 each repo in the repository index (specifically, to the "summary",
141 "commit" and "tree" pages). Default value: "0".
144 Flag which, when set to "1", will make cgit display the owner of
145 each repo in the repository index. Default value: "1".
147 enable-log-filecount::
148 Flag which, when set to "1", will make cgit print the number of
149 modified files for each commit on the repository log page. Default
152 enable-log-linecount::
153 Flag which, when set to "1", will make cgit print the number of added
154 and removed lines for each commit on the repository log page. Default
157 enable-remote-branches::
158 Flag which, when set to "1", will make cgit display remote branches
159 in the summary and refs views. Default value: "0". See also:
160 "repo.enable-remote-branches".
162 enable-subject-links::
163 Flag which, when set to "1", will make cgit use the subject of the
164 parent commit as link text when generating links to parent commits
165 in commit view. Default value: "0". See also:
166 "repo.enable-subject-links".
168 enable-tree-linenumbers::
169 Flag which, when set to "1", will make cgit generate linenumber links
170 for plaintext blobs printed in the tree view. Default value: "1".
173 Flag which, when set to "1", will allow cgit to use git config to set
174 any repo specific settings. This option is used in conjunction with
175 "scan-path", and must be defined prior, to augment repo-specific
176 settings. The keys gitweb.owner, gitweb.category, and gitweb.description
177 will map to the cgit keys repo.owner, repo.section, and repo.desc,
178 respectivly. All git config keys that begin with "cgit." will be mapped
179 to the corresponding "repo." key in cgit. Default value: "0". See also:
180 scan-path, section-from-path.
183 Url used as link to a shortcut icon for cgit. It is suggested to use
184 the value "/favicon.ico" since certain browsers will ignore other
185 values. Default value: "/favicon.ico".
188 The content of the file specified with this option will be included
189 verbatim at the bottom of all pages (i.e. it replaces the standard
190 "generated by..." message. Default value: none.
193 The content of the file specified with this option will be included
194 verbatim in the html HEAD section on all pages. Default value: none.
197 The content of the file specified with this option will be included
198 verbatim at the top of all pages. Default value: none.
201 Name of a configfile to include before the rest of the current config-
202 file is parsed. Default value: none. See also: "MACRO EXPANSION".
205 The content of the file specified with this option will be included
206 verbatim above the repository index. This setting is deprecated, and
207 will not be supported by cgit-1.0 (use root-readme instead). Default
211 The content of the file specified with this option will be included
212 verbatim below the heading on the repository index page. This setting
213 is deprecated, and will not be supported by cgit-1.0 (use root-desc
214 instead). Default value: none.
217 Flag which, if set to "1", makes cgit print commit and tag times in the
218 servers timezone. Default value: "0".
221 Url which specifies the source of an image which will be used as a logo
222 on all cgit pages. Default value: "/cgit.png".
225 Url loaded when clicking on the cgit logo image. If unspecified the
226 calculated url of the repository index page will be used. Default
230 Specifies the number of items to display in atom feeds view. Default
234 Specifies the number of entries to list per page in "log" view. Default
238 Specifies the maximum number of commit message characters to display in
239 "log" view. Default value: "80".
242 Specifies the number of entries to list per page on the repository
243 index page. Default value: "50".
245 max-repodesc-length::
246 Specifies the maximum number of repo description characters to display
247 on the repository index page. Default value: "80".
250 Specifies the maximum size of a blob to display HTML for in KBytes.
251 Default value: "0" (limit disabled).
254 Set the default maximum statistics period. Valid values are "week",
255 "month", "quarter" and "year". If unspecified, statistics are
256 disabled. Default value: none. See also: "repo.max-stats".
259 Set the mimetype for the specified filename extension. This is used
260 by the `plain` command when returning blob content.
263 Specifies the file to use for automatic mimetype lookup. If specified
264 then this field is used as a fallback when no "mimetype.<ext>" match is
265 found. If unspecified then no such lookup is performed. The typical file
266 to use on a Linux system is /etc/mime.types. The format of the file must
268 - a comment line is an empty line or a line starting with a hash (#),
269 optionally preceded by whitespace
270 - a non-comment line starts with the mimetype (like image/png), followed
271 by one or more file extensions (like jpg), all separated by whitespace
272 Default value: none. See also: "mimetype.<ext>".
275 Text which will be used as the formatstring for a hyperlink when a
276 submodule is printed in a directory listing. The arguments for the
277 formatstring are the path and SHA1 of the submodule commit. Default
281 If set to the value "1" caching will be disabled. This settings is
282 deprecated, and will not be honored starting with cgit-1.0. Default
286 If set to "1" showing full author email adresses will be disabled.
290 Flag which, when set to "1", will make cgit omit the standard header
291 on all pages. Default value: none. See also: "embedded".
294 A list of subdirectories inside of scan-path, relative to it, that
295 should loaded as git repositories. This must be defined prior to
296 scan-path. Default value: none. See also: scan-path, "MACRO
300 Text which will be used as default value for "repo.readme". Multiple
301 config keys may be specified, and cgit will use the first found file
302 in this list. This is useful in conjunction with scan-path. Default
303 value: none. See also: scan-path, repo.readme.
306 If set to "1" and scan-path is enabled, if any repositories are found
307 with a suffix of ".git", this suffix will be removed for the url and
308 name. This must be defined prior to scan-path. Default value: "0".
312 Maximum number of files to consider when detecting renames. The value
313 "-1" uses the compiletime value in git (for further info, look at
314 `man git-diff`). Default value: "-1".
317 Legacy alias for "section". This option is deprecated and will not be
318 supported in cgit-1.0.
321 The way in which repositories in each section are sorted. Valid values
322 are "name" for sorting by the repo name or "age" for sorting by the
323 most recently updated repository. Default value: "name". See also:
324 section, case-sensitive-sort, section-sort.
327 Text used as content for the "robots" meta-tag. Default value:
331 Text printed below the heading on the repository index page. Default
332 value: "a fast webinterface for the git dscm".
335 The content of the file specified with this option will be included
336 verbatim below the "about" link on the repository index page. Default
340 Text printed as heading on the repository index page. Default value:
341 "Git Repository Browser".
344 If set to "1" and scan-path is enabled, scan-path will recurse into
345 directories whose name starts with a period ('.'). Otherwise,
346 scan-path will stay away from such directories (considered as
347 "hidden"). Note that this does not apply to the ".git" directory in
348 non-bare repos. This must be defined prior to scan-path.
349 Default value: 0. See also: scan-path.
352 A path which will be scanned for repositories. If caching is enabled,
353 the result will be cached as a cgitrc include-file in the cache
354 directory. If project-list has been defined prior to scan-path,
355 scan-path loads only the directories listed in the file pointed to by
356 project-list. Be advised that only the global settings taken
357 before the scan-path directive will be applied to each repository.
358 Default value: none. See also: cache-scanrc-ttl, project-list,
362 The name of the current repository section - all repositories defined
363 after this option will inherit the current section name. Default value:
367 Flag which, when set to "1", will sort the sections on the repository
368 listing by name. Set this flag to "0" if the order in the cgitrc file should
369 be preserved. Default value: "1". See also: section,
370 case-sensitive-sort, repository-sort.
373 A number which, if defined prior to scan-path, specifies how many
374 path elements from each repo path to use as a default section name.
375 If negative, cgit will discard the specified number of path elements
376 above the repo directory. Default value: "0".
379 If set to "1" shows side-by-side diffs instead of unidiffs per
380 default. Default value: "0".
383 Text which specifies the default set of snapshot formats generated by
384 cgit. The value is a space-separated list of zero or more of the
385 values "tar", "tar.gz", "tar.bz2", "tar.xz" and "zip". Default value:
389 Specifies a command which will be invoked to format plaintext blobs
390 in the tree view. The command will get the blob content on its STDIN
391 and the name of the blob as its only command line argument. The STDOUT
392 from the command will be included verbatim as the blob contents, i.e.
393 this can be used to implement e.g. syntax highlighting. Default value:
394 none. See also: "FILTER API".
397 Specifies the number of branches to display in the repository "summary"
398 view. Default value: "10".
401 Specifies the number of log entries to display in the repository
402 "summary" view. Default value: "10".
405 Specifies the number of tags to display in the repository "summary"
406 view. Default value: "10".
409 Filename which, if specified, needs to be present within the repository
410 for cgit to allow access to that repository. This can be used to emulate
411 gitweb's EXPORT_OK and STRICT_EXPORT functionality and limit cgit's
412 repositories to match those exported by git-daemon. This option must
413 be defined prior to scan-path.
416 Url which, if specified, will be used as root for all cgit links. It
417 will also cause cgit to generate 'virtual urls', i.e. urls like
418 '/cgit/tree/README' as opposed to '?r=cgit&p=tree&path=README'. Default
420 NOTE: cgit has recently learned how to use PATH_INFO to achieve the
421 same kind of virtual urls, so this option will probably be deprecated.
427 Override the default about-filter. Default value: none. See also:
428 "enable-filter-overrides". See also: "FILTER API".
431 Flag which, when set to "age", enables date ordering in the branch ref
432 list, and when set to "name" enables ordering by branch name. Default
436 A list of space-separated urls which can be used to clone this repo.
437 Default value: none. See also: "MACRO EXPANSION".
440 Override the default commit-filter. Default value: none. See also:
441 "enable-filter-overrides". See also: "FILTER API".
444 Flag which, when set to "date", enables strict date ordering in the
445 commit log, and when set to "topo" enables strict topological
446 ordering. If unset, the default ordering of "git log" is used. Default
450 The name of the default branch for this repository. If no such branch
451 exists in the repository, the first branch name (when sorted) is used
452 as default instead. Default value: branch pointed to by HEAD, or
453 "master" if there is no suitable HEAD.
456 The value to show as repository description. Default value: none.
458 repo.enable-commit-graph::
459 A flag which can be used to disable the global setting
460 `enable-commit-graph'. Default value: none.
462 repo.enable-log-filecount::
463 A flag which can be used to disable the global setting
464 `enable-log-filecount'. Default value: none.
466 repo.enable-log-linecount::
467 A flag which can be used to disable the global setting
468 `enable-log-linecount'. Default value: none.
470 repo.enable-remote-branches::
471 Flag which, when set to "1", will make cgit display remote branches
472 in the summary and refs views. Default value: <enable-remote-branches>.
474 repo.enable-subject-links::
475 A flag which can be used to override the global setting
476 `enable-subject-links'. Default value: none.
479 Url which specifies the source of an image which will be used as a logo
480 on this repo's pages. Default value: global logo.
483 Url loaded when clicking on the cgit logo image. If unspecified the
484 calculated url of the repository index page will be used. Default
485 value: global logo-link.
488 Text which will be used as the formatstring for a hyperlink when a
489 submodule is printed in a directory listing. The arguments for the
490 formatstring are the path and SHA1 of the submodule commit. Default
493 repo.module-link.<path>::
494 Text which will be used as the formatstring for a hyperlink when a
495 submodule with the specified subdirectory path is printed in a
496 directory listing. The only argument for the formatstring is the SHA1
497 of the submodule commit. Default value: none.
500 Override the default maximum statistics period. Valid values are equal
501 to the values specified for the global "max-stats" setting. Default
505 The value to show as repository name. Default value: <repo.url>.
508 A value used to identify the owner of the repository. Default value:
512 An absolute path to the repository directory. For non-bare repositories
513 this is the .git-directory. Default value: none.
516 A path (relative to <repo.path>) which specifies a file to include
517 verbatim as the "About" page for this repo. You may also specify a
518 git refspec by head or by hash by prepending the refspec followed by
519 a colon. For example, "master:docs/readme.mkd". If the value begins
520 with a colon, i.e. ":docs/readme.rst", the default branch of the
521 repository will be used. Sharing any file will expose that entire
522 directory tree to the "/about/PATH" endpoints, so be sure that there
523 are no non-public files located in the same directory as the readme
524 file. Default value: <readme>.
527 A mask of allowed snapshot-formats for this repo, restricted by the
528 "snapshots" global setting. Default value: <snapshots>.
531 Override the current section name for this repository. Default value:
535 Override the default source-filter. Default value: none. See also:
536 "enable-filter-overrides". See also: "FILTER API".
539 The relative url used to access the repository. This must be the first
540 setting specified for each repo. Default value: none.
543 REPOSITORY-SPECIFIC CGITRC FILE
544 -------------------------------
545 When the option "scan-path" is used to auto-discover git repositories, cgit
546 will try to parse the file "cgitrc" within any found repository. Such a
547 repo-specific config file may contain any of the repo-specific options
548 described above, except "repo.url" and "repo.path". Additionally, the "filter"
549 options are only acknowledged in repo-specific config files when
550 "enable-filter-overrides" is set to "1".
552 Note: the "repo." prefix is dropped from the option names in repo-specific
553 config files, e.g. "repo.desc" becomes "desc".
559 This filter is given a single parameter: the filename of the source
560 file to filter. The filter can use the filename to determine (for
561 example) the type of syntax to follow when formatting the readme file.
562 The about text that is to be filtered is available on standard input
563 and the filtered text is expected on standard output.
566 This filter is given no arguments. The commit message text that is to
567 be filtered is available on standard input and the filtered text is
568 expected on standard output.
571 This filter is given a single parameter: the filename of the source
572 file to filter. The filter can use the filename to determine (for
573 example) the syntax highlighting mode. The contents of the source
574 file that is to be filtered is available on standard input and the
575 filtered contents is expected on standard output.
577 Also, all filters are handed the following environment variables:
579 - CGIT_REPO_URL (from repo.url)
580 - CGIT_REPO_NAME (from repo.name)
581 - CGIT_REPO_PATH (from repo.path)
582 - CGIT_REPO_OWNER (from repo.owner)
583 - CGIT_REPO_DEFBRANCH (from repo.defbranch)
584 - CGIT_REPO_SECTION (from repo.section)
585 - CGIT_REPO_CLONE_URL (from repo.clone-url)
587 If a setting is not defined for a repository and the corresponding global
588 setting is also not defined (if applicable), then the corresponding
589 environment variable will be unset.
594 The following cgitrc options supports a simple macro expansion feature,
595 where tokens prefixed with "$" are replaced with the value of a similary
596 named environment variable:
603 Macro expansion will also happen on the content of $CGIT_CONFIG, if
606 One usage of this feature is virtual hosting, which in its simplest form
607 can be accomplished by adding the following line to /etc/cgitrc:
609 include=/etc/cgitrc.d/$HTTP_HOST
611 The following options are expanded during request processing, and support
612 the environment variables defined in "FILTER API":
622 # Enable caching of up to 1000 output entriess
626 # Specify some default clone urls using macro expansion
627 clone-url=git://foo.org/$CGIT_REPO_URL git@foo.org:$CGIT_REPO_URL
629 # Specify the css url
633 # Show owner on index page
637 # Allow http transport git clone
641 # Show extra links for each repository on the index page
645 # Enable ASCII art commit history graph on the log pages
646 enable-commit-graph=1
649 # Show number of affected files per commit on the log pages
650 enable-log-filecount=1
653 # Show number of added/removed lines per commit on the log pages
654 enable-log-linecount=1
657 # Sort branches by date
669 # Enable statistics per week, month and quarter
673 # Set the title and heading of the repository index page
674 root-title=example.com git repositories
677 # Set a subheading for the repository index page
678 root-desc=tracking the foobar development
681 # Include some more info about example.com on the index page
682 root-readme=/var/www/htdocs/about.html
685 # Allow download of tar.gz, tar.bz2 and zip-files
686 snapshots=tar.gz tar.bz2 zip
690 ## List of common mimetypes
693 mimetype.gif=image/gif
694 mimetype.html=text/html
695 mimetype.jpg=image/jpeg
696 mimetype.jpeg=image/jpeg
697 mimetype.pdf=application/pdf
698 mimetype.png=image/png
699 mimetype.svg=image/svg+xml
702 # Highlight source code with python pygments-based highligher
703 source-filter=/var/www/cgit/filters/syntax-highlighting.py
705 # Format markdown, restructuredtext, manpages, text files, and html files
706 # through the right converters
707 about-filter=/var/www/cgit/filters/about-formatting.sh
710 ## Search for these files in the root of the default branch of repositories
711 ## for coming up with the about page:
744 ## List of repositories.
745 ## PS: Any repositories listed when section is unset will not be
746 ## displayed under a section heading
747 ## PPS: This list could be kept in a different file (e.g. '/etc/cgitrepos')
748 ## and included like this:
749 ## include=/etc/cgitrepos
754 repo.path=/pub/git/foo.git
755 repo.desc=the master foo repository
756 repo.owner=fooman@example.com
757 repo.readme=info/web/about.html
761 repo.path=/pub/git/bar.git
762 repo.desc=the bars for your foo
763 repo.owner=barman@example.com
764 repo.readme=info/web/about.html
767 # The next repositories will be displayed under the 'extras' heading
772 repo.path=/pub/git/baz.git
773 repo.desc=a set of extensions for bar users
776 repo.path=/pub/git/wiz.git
777 repo.desc=the wizard of foo
780 # Add some mirrored repositories
785 repo.path=/pub/git/git.git
790 repo.path=/pub/git/linux.git
793 # Disable adhoc downloads of this repo
796 # Disable line-counts for this repo
797 repo.enable-log-linecount=0
799 # Restrict the max statistics period for this repo
806 Comments currently cannot appear on the same line as a setting; the comment
807 will be included as part of the value. E.g. this line:
809 robots=index # allow indexing
811 will generate the following html element:
813 <meta name='robots' content='index # allow indexing'/>
819 Lars Hjemli <hjemli@gmail.com>
820 Jason A. Donenfeld <Jason@zx2c4.com>