CGITRC(5)
π cgitrc(5) β runtime configuration for cgit π
omg bestie, welcome to the cgitrc(5) manual β this is literally the runtime configuration for cgit. It's giving "all the settings you could ever want". We're doing part 1, so buckle up. π
π NAME π
cgitrc β runtime configuration for cgit
π SYNOPSIS π
So like, cgitrc holds every single runtime setting for cgit, including the list of git repositories. It's formatted as a line-separated list of NAME=VALUE pairs. Blank lines? Ignored. Lines starting with #? Also ignored. Periodt. π
π LOCATION π
The default location of cgitrc, defined at compile time, is /etc/cgitrc. At runtime, cgit will consult the environment variable CGIT_CONFIG and, if defined, use its value instead. So you can point it elsewhere if you want. β¨
π GLOBAL SETTINGS π
Okay bestie, here's where the magic happens. These are the global settings β they apply to everything unless overridden in a repo-specific config. Let's go one by one, no skips. π
about-filterβ Specifies a command which will be invoked to format the content of about pages (both top-level and for each repository). The command will get the content of the about-file on its STDIN, the name of the file as the first argument, and the STDOUT from the command will be included verbatim on the about page. Default value: none. See also: "FILTER API". πΈagefileβ Specifies a path, relative to each repository path, which can be used to specify the date and time of the youngest commit in the repository. The first line in the file is used as input to theparse_datefunction in libgit. Recommended timestamp-format is"yyyy-mm-dd hh:mm:ss". You may want to generate this file from a post-receive hook. Default value:"info/web/last-modified". π°οΈauth-filterβ Specifies a command that will be invoked for authenticating repository access. Receives quite a few arguments, and data on both stdin and stdout for authentication processing. Details follow later in this document. If no auth-filter is specified, no authentication is performed. Default value: none. See also: "FILTER API". πbranch-sortβ Flag which, when set to"age", enables date ordering in the branch ref list, and when set to"name"enables ordering by branch name. Default value:"name". πΏcache-about-ttlβ Number which specifies the time-to-live, in minutes, for the cached version of the repository about page. See also: "CACHE". Default value:"15". β³cache-dynamic-ttlβ Number which specifies the time-to-live, in minutes, for the cached version of repository pages accessed without a fixed SHA1. See also: "CACHE". Default value:"5". β³cache-repo-ttlβ Number which specifies the time-to-live, in minutes, for the cached version of the repository summary page. See also: "CACHE". Default value:"5". β³cache-rootβ Path used to store the cgit cache entries. Default value:"/var/cache/cgit". See also: "MACRO EXPANSION". πcache-root-ttlβ Number which specifies the time-to-live, in minutes, for the cached version of the repository index page. See also: "CACHE". Default value:"5". β³cache-scanrc-ttlβ Number which specifies the time-to-live, in minutes, for the result of scanning a path for git repositories. See also: "CACHE". Default value:"15". β³case-sensitive-sortβ Sort items in the repo list case sensitively. Default value:"1". See also:repository-sort,section-sort. π€cache-sizeβ The maximum number of entries in the cgit cache. When set to"0", caching is disabled. See also: "CACHE". Default value:"0". ποΈcache-snapshot-ttlβ Number which specifies the time-to-live, in minutes, for the cached version of snapshots. See also: "CACHE". Default value:"5". β³cache-static-ttlβ Number which specifies the time-to-live, in minutes, for the cached version of repository pages accessed with a fixed SHA1. See also: "CACHE". Default value:-1". β³clone-prefixβ Space-separated list of common prefixes which, when combined with a repository url, generates valid clone urls for the repository. This setting is only used ifrepo.clone-urlis unspecified. Default value: none. πclone-urlβ Space-separated list of clone-url templates. This setting is only used ifrepo.clone-urlis unspecified. Default value: none. See also: "MACRO EXPANSION", "FILTER API". πcommit-filterβ Specifies a command which will be invoked to format commit messages. The command will get the message on its STDIN, and the STDOUT from the command will be included verbatim as the commit message, i.e. this can be used to implement bugtracker integration. Default value: none. See also: "FILTER API". π¬commit-sortβ Flag which, when set to"date", enables strict date ordering in the commit log, and when set to"topo"enables strict topological ordering. If unset, the default ordering ofgit logis used. Default value: unset. πcssβ Url which specifies the css document to include in all cgit pages. Default value:"/cgit.css". May be given multiple times, each css URL path is added in the head section of the document in turn. π¨email-filterβ Specifies a command which will be invoked to format names and email address of committers, authors, and taggers, as represented in various places throughout the cgit interface. This command will receive an email address and an origin page string as its command line arguments, and the text to format on STDIN. It is to write the formatted text back out onto STDOUT. Default value: none. See also: "FILTER API". π§embeddedβ Flag which, when set to"1", will make cgit generate a html fragment suitable for embedding in other html pages. Default value: none. See also: "noheader". π§©enable-blameβ Flag which, when set to"1", will allow cgit to provide a "blame" page for files, and will make it generate links to that page in appropriate places. Default value:"0". πenable-commit-graphβ Flag which, when set to"1", will make cgit print an ASCII-art commit history graph to the left of the commit messages in the repository log page. Default value:"0". πenable-filter-overridesβ Flag which, when set to"1", allows all filter settings to be overridden in repository-specific cgitrc files. Default value: none. ποΈenable-follow-linksβ Flag which, when set to"1", allows users to follow a file in the log view. Default value:"0". πenable-git-configβ Flag which, when set to"1", will allow cgit to use git config to set any repo specific settings. This option is used in conjunction withscan-path, and must be defined prior, to augment repo-specific settings. The keysgitweb.owner,gitweb.category,gitweb.description, andgitweb.homepagewill map to the cgit keysrepo.owner,repo.section,repo.desc, andrepo.homepagerespectively. All git config keys that begin with"cgit."will be mapped to the corresponding"repo."key in cgit. Default value:"0". See also:scan-path,section-from-path. βοΈenable-http-cloneβ If set to"1", cgit will act as a dumb HTTP endpoint for git clones. You can add"http://$HTTP_HOST$SCRIPT_NAME/$CGIT_REPO_URL"toclone-urlto expose this feature. If you use an alternate way of serving git repositories, you may wish to disable this. Default value:"1". πenable-html-servingβ Flag which, when set to"1", will allow the/plainhandler to serve mimetype headers that result in the file being treated as HTML by the browser. When set to"0", such file types are returned instead astext/plainorapplication/octet-stream. Default value:"0". See also: "repo.enable-html-serving". πenable-index-linksβ Flag which, when set to"1", will make cgit generate extra links for each repo in the repository index (specifically, to the"summary","commit"and"tree"pages). Default value:"0". πenable-index-ownerβ Flag which, when set to"1", will make cgit display the owner of each repo in the repository index. Default value:"1". π€enable-log-filecountβ Flag which, when set to"1", will make cgit print the number of modified files for each commit on the repository log page. Default value:"0". πenable-log-linecountβ Flag which, when set to"1", will make cgit print the number of added and removed lines for each commit on the repository log page. Default value:"0". πenable-remote-branchesβ Flag which, when set to"1", will make cgit display remote branches in the summary and refs views. Default value:"0". See also: "repo.enable-remote-branches". πΏenable-subject-linksβ Flag which, when set to"1", will make cgit use the subject of the parent commit as link text when generating links to parent commits in commit view. Default value:"0". See also: "repo.enable-subject-links". πenable-tree-linenumbersβ Flag which, when set to"1", will make cgit generate linenumber links for plaintext blobs printed in the tree view. Default value:"1". π’faviconβ Url used as link to a shortcut icon for cgit. It is suggested to use the value"/favicon.ico"since certain browsers will ignore other values. Default value:"/favicon.ico". πfooterβ The content of the file specified with this option will be included verbatim at the bottom of all pages (i.e. it replaces the standard "generated by..." message. Default value: none. π£head-includeβ The content of the file specified with this option will be included verbatim in the html HEAD section on all pages. Default value: none. π§headerβ The content of the file specified with this option will be included verbatim at the top of all pages. Default value: none. ποΈincludeβ Name of a configfile to include before the rest of the current config- file is parsed. Default value: none. See also: "MACRO EXPANSION". π₯jsβ Url which specifies the javascript script document to include in all cgit pages. Default value:"/cgit.js". Setting this to an empty string will disable generation of the link to this file in the head section. πlocal-timeβ Flag which, if set to"1", makes cgit print commit and tag times in the servers timezone. Default value:"0". πlogoβ Url which specifies the source of an image which will be used as a logo on all cgit pages. Default value:"/cgit.png". πΌοΈlogo-linkβ Url loaded when clicking on the cgit logo image. If unspecified the calculated url of the repository index page will be used. Default value: none. πmax-atom-itemsβ Specifies the number of items to display in atom feeds view. Default value:"10". π°max-blob-sizeβ Specifies the maximum size of a blob to display HTML for in KBytes. Default value:"0"(limit disabled). π¦max-commit-countβ okay bestie, this sets the number of entries to list per page in the "log" view. Default value:"50". πmax-message-lengthβ the max number of commit message characters to show in the "log" view. Default value:"80". β¨max-repo-countβ number of entries to list per page on the repository index page. The value"0"shows all repositories without limitation. Default value:"50". πmax-repodesc-lengthβ the max number of repo description characters to display on the repository index page. Default value:"80". πmax-statsβ sets the default maximum statistics period. Valid values are"week","month","quarter"and"year". If unspecified, statistics are disabled. Default value: none. See also:repo.max-stats. π₯mimetype.<ext>β set the mimetype for the specified filename extension. This is used by theplaincommand when returning blob content. πΈmimetype-fileβ specifies the file to use for automatic mimetype lookup. If specified, then this field is used as a fallback when nomimetype.<ext>match is found. If unspecified, then no such lookup is performed. The typical file to use on a Linux system is/etc/mime.types. The format of the file must comply to:- a comment line is an empty line or a line starting with a hash (
#), optionally preceded by whitespace - a non-comment line starts with the mimetype (like
image/png), followed by one or more file extensions (likejpg), all separated by whitespace Default value: none. See also:mimetype.<ext>. π¦
- a comment line is an empty line or a line starting with a hash (
module-linkβ text which will be used as the formatstring for a hyperlink when a submodule is printed in a directory listing. The arguments for the formatstring are the path and SHA1 of the submodule commit. Default value: none. πnoplainemailβ if set to"1", showing full author email addresses will be disabled. Default value:"0". πnoheaderβ flag which, when set to"1", will make cgit omit the standard header on all pages. Default value: none. See also:embedded. πowner-filterβ specifies a command which will be invoked to format the Owner column of the main page. The command will get the owner on STDIN, and the STDOUT from the command will be included verbatim in the table. This can be used to link to additional context such as an owner's home page. When active, this filter is used instead of the default owner query url. Default value: none. See also: "FILTER API". π«Άproject-listβ a list of subdirectories inside ofscan-path, relative to it, that should be loaded as git repositories. This must be defined prior toscan-path. Default value: none. See also:scan-path, "MACRO EXPANSION". πreadmeβ text which will be used as default value forrepo.readme. Multiple config keys may be specified, and cgit will use the first found file in this list. This is useful in conjunction withscan-path. Default value: none. See also:scan-path,repo.readme. πremove-suffixβ if set to"1"andscan-pathis enabled, if any repositories are found with a suffix of".git", this suffix will be removed for the url and name. This must be defined prior toscan-path. Default value:"0". See also:scan-path. β¨renamelimitβ maximum number of files to consider when detecting renames. The value"-1"uses the compiletime value in git (for further info, look atman git-diff). Default value:"-1". πrepository-sortβ the way in which repositories in each section are sorted. Valid values are"name"for sorting by the repo name or"age"for sorting by the most recently updated repository. Default value:"name". See also:section,case-sensitive-sort,section-sort. π₯robotsβ text used as content for the "robots" meta-tag. Default value:"index, nofollow". πroot-descβ text printed below the heading on the repository index page. Default value:"a fast webinterface for the git dscm". πroot-readmeβ the content of the file specified with this option will be included verbatim below the "about" link on the repository index page. Default value: none. πroot-titleβ text printed as heading on the repository index page. Default value:"Git Repository Browser". πscan-hidden-pathβ if set to"1"andscan-pathis enabled,scan-pathwill recurse into directories whose name starts with a period (.). Otherwise,scan-pathwill stay away from such directories (considered as "hidden"). Note that this does not apply to the".git"directory in non-bare repos. This must be defined prior toscan-path. Default value:0. See also:scan-path. πscan-pathβ a path which will be scanned for repositories. If caching is enabled, the result will be cached as a cgitrc include-file in the cache directory. Ifproject-listhas been defined prior toscan-path,scan-pathloads only the directories listed in the file pointed to byproject-list. Be advised that only the global settings taken before thescan-pathdirective will be applied to each repository. Default value: none. See also:cache-scanrc-ttl,project-list, "MACRO EXPANSION". π§sectionβ the name of the current repository section; all repositories defined after this option will inherit the current section name. Default value: none. πsection-sortβ flag which, when set to"1", will sort the sections on the repository listing by name. Set this flag to"0"if the order in thecgitrcfile should be preserved. Default value:"1". See also:section,case-sensitive-sort,repository-sort. βsection-from-pathβ a number which, if defined prior toscan-path, specifies how many path elements from each repo path to use as a default section name. If negative, cgit will discard the specified number of path elements above the repo directory. Default value:"0". π¦side-by-side-diffsβ if set to"1", shows side-by-side diffs instead of unidiffs per default. Default value:"0". πsnapshotsβ text which specifies the default set of snapshot formats that cgit generates links for. The value is a space-separated list of zero or more of the values"tar","tar.gz","tar.bz2","tar.lz","tar.xz","tar.zst"and"zip". The special value"all"enables all snapshot formats. Default value: none. All compressors use default settings. Some settings can be influenced with environment variables, for example setZSTD_CLEVEL=10in web server environment for higher (but slower) zstd compression. π₯source-filterβ specifies a command which will be invoked to format plaintext blobs in the tree view. The command will get the blob content on its STDIN and the name of the blob as its only command line argument. The STDOUT from the command will be included verbatim as the blob contents, i.e. this can be used to implement e.g. syntax highlighting. Default value: none. See also: "FILTER API". πΈsummary-branchesβ specifies the number of branches to display in the repository "summary" view. Default value:"10". πsummary-logβ specifies the number of log entries to display in the repository "summary" view. Default value:"10". β¨summary-tagsβ specifies the number of tags to display in the repository "summary" view. Default value:"10". πstrict-exportβ filename which, if specified, needs to be present within the repository for cgit to allow access to that repository. This can be used to emulate gitwebβsEXPORT_OKandSTRICT_EXPORTfunctionality and limit cgitβs repositories to match those exported bygit-daemon. This option must be defined prior toscan-path. πvirtual-rootβ url which, if specified, will be used as root for all cgit links. It will also cause cgit to generate virtual urls, i.e. urls like/cgit/tree/READMEas opposed to?r=cgit&p=tree&path=README. Default value: none. NOTE: cgit has recently learned how to use PATH_INFO to achieve the same kind of virtual urls, so this option will probably be deprecated. π«Ά
π REPOSITORY SETTINGS π
okay bestie, this is the part where every setting gets its own little repo. glow-up π
these override the global stuff for one specific repository, so you can have a chaos repo and a normal repo living in the same cgit without them fighting.
repo.about-filterβ overrides the defaultabout-filterfor this repo. Default value:none. See also: "enable-filter-overrides". See also: "FILTER API".repo.branch-sortβ a flag, and when you set it to"age"you get date ordering in the branch ref list, and when you set it to"name"you get ordering by branch name. Default value:"name".repo.clone-urlβ a list of space-separated urls you can use to clone this repo. Default value:none. See also: "MACRO EXPANSION".repo.commit-filterβ overrides the defaultcommit-filter. Default value:none. See also: "enable-filter-overrides". See also: "FILTER API".repo.commit-sortβ a flag; set it to"date"for strict date ordering in the commit log, or"topo"for strict topological ordering. If you leave it unset, you just get the default ordering ofgit log. Default value: unset.repo.defbranchβ the name of the default branch for this repository. If that branch literally doesn't exist in the repo, the first branch name (when sorted) gets used as default instead. Default value: the branch pointed to byHEAD, or"master"if there's no suitableHEAD.repo.descβ the value shown as the repository description. Default value:none.repo.email-filterβ overrides the defaultemail-filter. Default value:none. See also: "enable-filter-overrides". See also: "FILTER API".repo.enable-blameβ a flag you can use to disable the global setting 'enable-blame'. Default value:none.repo.enable-commit-graphβ a flag you can use to disable the global setting 'enable-commit-graph'. Default value:none.repo.enable-follow-linksβ a flag you can use to disable the global setting 'enable-follow-links'. Default value:none.repo.enable-html-servingβ a flag you can use to override the global settingenable-html-serving. Default value:none.repo.enable-log-filecountβ a flag you can use to disable the global setting 'enable-log-filecount'. Default value:none.repo.enable-log-linecountβ a flag you can use to disable the global setting 'enable-log-linecount'. Default value:none.repo.enable-remote-branchesβ a flag, and when it's set to"1"cgit will display remote branches in the summary and refs views. Default value:<enable-remote-branches>.repo.enable-subject-linksβ a flag you can use to override the global setting 'enable-subject-links'. Default value:none.repo.extra-head-contentβ this value gets added verbatim to the head section of every page displayed for this repo. Default value:none.repo.hideβ a flag; when set to"1"it hides the repository from the repository index. The repo is still reachable if you hand over a direct path tho. Default value:"0". See also: "repo.ignore".repo.homepageβ the value shown as the repository homepage. Default value:none.repo.ignoreβ a flag; when set to"1"it ignores the repository entirely β not shown in the index and not accessible even with a direct path. Default value:"0". See also: "repo.hide".repo.logoβ the url that says where the image comes from, used as a logo on this repo's pages. Default value: globallogo.repo.logo-linkβ the url loaded when you click on the cgit logo image. If you don't specify it, the calculated url of the repository index page gets used. Default value: globallogo-link.repo.module-linkβ text used as the formatstring for a hyperlink when a submodule is printed in a directory listing. The arguments for the formatstring are the path and the SHA1 of the submodule commit. Default value:<module-link>.repo.module-link.<path>β text used as the formatstring for a hyperlink when a submodule with that specific subdirectory path gets printed in a directory listing. The only argument for the formatstring is the SHA1 of the submodule commit. Default value:none.repo.max-statsβ overrides the default maximum statistics period. Valid values are the same as the values you'd specify for the global"max-stats"setting. Default value:none.repo.nameβ the value shown as the repository name. Default value:<repo.url>.repo.ownerβ a value used to identify who owns the repository. Default value:none.repo.owner-filterβ overrides the defaultowner-filter. Default value:none. See also: "enable-filter-overrides". See also: "FILTER API".repo.pathβ an absolute path to the repository directory. For non-bare repositories this is the.gitdirectory. Default value:none.repo.readmeβ a path (relative to<repo.path>) that says which file to include verbatim as the "About" page for this repo. You can also hand it a git refspec by head or by hash by prepending the refspec followed by a colon. For example,"master:docs/readme.mkd". If the value begins with a colon, like":docs/readme.rst", then the head given in the query or the default branch of the repository gets used. β οΈ Sharing any file will expose that entire directory tree to the"/about/PATH"endpoints, so fr fr make sure there are no non-public files sitting in the same directory as the readme file. Default value:<readme>.
π bestie that readme one is not a drill. you share one file, you shared the whole folder. check before you ship.
repo.sectionβ overrides the current section name for this repository. Default value:none.repo.snapshotsβ a mask of snapshot formats for this repo that cgit generates links for, restricted by the global"snapshots"setting. Default value:<snapshots>.repo.snapshot-prefixβ a prefix to use for snapshot links instead of the repository basename. For example, the"linux-stable"repository may wish to set this to"linux"so that snapshots come out in the format"linux-3.15.4"instead of"linux-stable-3.15.4". Default value:<empty>, which means use the repository basename.repo.source-filterβ overrides the defaultsource-filter. Default value:none. See also: "enable-filter-overrides". See also: "FILTER API".repo.urlβ the relative url used to access the repository. This must be the first setting specified for each repo. Default value:none.
π REPOSITORY-SPECIFIC CGITRC FILE π
okay so when the option "scan-path" is out here auto-discovering git repositories, cgit will try to parse the file "cgitrc" inside any repository it finds. π
That repo-specific config file can contain any of the repo-specific options described above β with two exceptions, bestie: not "repo.url" and not "repo.path".
Also, on top of that, the "filter" options are only acknowledged in repo-specific config files when "enable-filter-overrides" is set to "1".
Note: the"repo."prefix gets dropped from the option names in repo-specific config files. So like,"repo.desc"becomesdesc. β¨
π FILTER API π
Okay bestie, so like, by default, filters are separate processes that are executed each time they are needed. Alternative technologies may be used by prefixing the filter specification with the relevant string. The available values are:
exec:β The default "one process per filter" mode. It's giving classic, no cap.lua:β Executes the script using a built-in Lua interpreter. The script is loaded once per execution of cgit, and may be called multiple times during cgitβs lifetime, making it a good choice for repeated filters such as the email filter. It responds to three functions:filter_open(argument1, argument2, argument3, ...)β This is called upon activation of the filter for a particular set of data.filter_write(buffer)β This is called whenever cgit writes data to the webpage.filter_close()β This is called when the current filtering operation is completed. It must return an integer value. Usually0indicates success.
Additionally, cgit exposes to the Lua the following built-in functions:
html(str)β Writesstrto the webpage.html_txt(str)β HTML escapes and writesstrto the webpage.html_attr(str)β HTML escapes for an attribute and writes"str'to the webpage.html_url_path(str)β URL escapes for a path and writesstrto the webpage.html_url_arg(str)β URL escapes for an argument and writesstrto the webpage.html_include(file)β Includesfilein webpage.
Parameters are provided to filters as follows.
π about filter π
This filter is given a single parameter: the filename of the source file to filter. The filter can use the filename to determine (for example) the type of syntax to follow when formatting the readme file. The about text that is to be filtered is available on standard input and the filtered text is expected on standard output.
π auth filter π
The authentication filter receives 12 parameters:
filter action, explained below, which specifies which action the filter is called forhttp cookiehttp methodhttp refererhttp pathhttp https flagcgit repocgit pagecgit urlcgit login urlWhen the filter action is"body", this filter must write to output the HTML for displaying the login form, which POSTs to the login url. When the filter action is"authenticate-cookie", this filter must validate the http cookie and return a0if it is invalid or1if it is invalid, in the exit code / close function. If the filter action is"authenticate-post", this filter receives POSTβd parameters on standard input, and should write a complete CGI response, preferably with a302redirect, and write to output one or more"Set-Cookie"HTTP headers, each followed by a newline.
π Please see filters/simple-authentication.lua for a clear example script that may be modified.
π commit filter π
This filter is given no arguments. The commit message text that is to be filtered is available on standard input and the filtered text is expected on standard output.
π§ email filter π§
This filter is given two parameters: the email address of the relevant author and a string indicating the originating page. The filter will then receive the text string to format on standard input and is expected to write to standard output the formatted text to be included in the page.
π owner filter π
This filter is given no arguments. The owner text is available on standard input and the filter is expected to write to standard output. The output is included in the Owner column.
π source filter π
This filter is given a single parameter: the filename of the source file to filter. The filter can use the filename to determine (for example) the syntax highlighting mode. The contents of the source file that is to be filtered is available on standard input and the filtered contents is expected on standard output.
All filters are handed the following environment variables:
CGIT_REPO_URL(fromrepo.url)CGIT_REPO_NAME(fromrepo.name)CGIT_REPO_PATH(fromrepo.path)CGIT_REPO_OWNER(fromrepo.owner)CGIT_REPO_DEFBRANCH(fromrepo.defbranch)CGIT_REPO_SECTION(fromrepo.section)CGIT_REPO_CLONE_URL(fromrepo.clone-url)
If a setting is not defined for a repository and the corresponding global setting is also not defined (if applicable), then the corresponding environment variable will be unset.
π¦ MACRO EXPANSION π¦
The following cgitrc options support a simple macro expansion feature, where tokens prefixed with "$" are replaced with the value of a similarly named environment variable:
cache-rootincludeproject-listscan-path
Macro expansion will also happen on the content of $CGIT_CONFIG, if defined.
One usage of this feature is virtual hosting, which in its simplest form can be accomplished by adding the following line to /etc/cgitrc:
include=/etc/cgitrc.d/$HTTP_HOST
The following options are expanded during request processing, and support the environment variables defined in "FILTER API":
clone-urlrepo.clone-url
πΈ CACHE πΈ
All cache ttl values are in minutes. Negative ttl values indicate that a page type will never expire, and thus the first time a URL is accessed, the result will be cached indefinitely, even if the underlying git repository changes. Conversely, when a ttl value is zero, the cache is disabled for that particular page type, and the page type is never cached.
β¨ SIGNATURES β¨
Cgit can host .asc signatures corresponding to various snapshot formats, through use of git notes. For example, the following command may be used to add a signature to a .tar.xz archive:
git notes --ref=refs/notes/signatures/tar.xz add -C "$(
gpg --output - --armor --detach-sign cgit-1.1.tar.xz |
git hash-object -w --stdin
)" v1.1
If it is instead desirable to attach a signature of the underlying .tar, this will be linked, as a special case, beside a .tar.* link that does not have its own signature. For example, a signature of a tarball of the latest tag might be added with a similar command:
tag="$(git describe --abbrev=0)"
git notes --ref=refs/notes/signatures/tar add -C "$(
git archive --format tar --prefix "cgit-${tag#v}/" "$tag" |
gpg --output - --armor --detach-sign |
git hash-object -w --stdin
)" "$tag"
Since git-archive(1) is expected to produce stable output between versions, this allows one to generate a long-term signature of the contents of a given tag.
π EXAMPLE CGITRC FILE π
okay bestie, this is the part everyone actually opens the manpage for π
β a whole real <pink>cgitrc</pink> that shows the settings living together in the wild. Every single line below is doing something, and every comment is your girl explaining herself. Read it like a group chat, not a textbook π«Ά
# Enable caching of up to 1000 output entries
cache-size=1000
# Specify some default clone urls using macro expansion
clone-url=git://foo.org/$CGIT_REPO_URL git@foo.org:$CGIT_REPO_URL
# Specify the css url
css=/css/cgit.css
# Show owner on index page
enable-index-owner=1
# Allow http transport git clone
enable-http-clone=1
# Show extra links for each repository on the index page
enable-index-links=1
# Enable blame page and create links to it from tree page
enable-blame=1
# Enable ASCII art commit history graph on the log pages
enable-commit-graph=1
# Show number of affected files per commit on the log pages
enable-log-filecount=1
# Show number of added/removed lines per commit on the log pages
enable-log-linecount=1
# Sort branches by date
branch-sort=age
# Add a cgit favicon
favicon=/favicon.ico
# Use a custom logo
logo=/img/mylogo.png
# Enable statistics per week, month and quarter
max-stats=quarter
# Set the title and heading of the repository index page
root-title=example.com git repositories
# Set a subheading for the repository index page
root-desc=tracking the foobar development
# Include some more info about example.com on the index page
root-readme=/var/www/htdocs/about.html
# Allow download of tar.gz, tar.bz2 and zip-files
snapshots=tar.gz tar.bz2 zip
##
## List of common mimetypes
##
mimetype.gif=image/gif
mimetype.html=text/html
mimetype.jpg=image/jpeg
mimetype.jpeg=image/jpeg
mimetype.pdf=application/pdf
mimetype.png=image/png
mimetype.svg=image/svg+xml
# Highlight source code with python pygments-based highlighter
source-filter=/var/www/cgit/filters/syntax-highlighting.py
# Format markdown, restructuredtext, manpages, text files, and html files
# through the right converters
about-filter=/var/www/cgit/filters/about-formatting.sh
##
## Search for these files in the root of the default branch of repositories
## for coming up with the about page:
##
readme=:README.md
readme=:readme.md
readme=:README.mkd
readme=:readme.mkd
readme=:README.rst
readme=:readme.rst
readme=:README.html
readme=:readme.html
readme=:README.htm
readme=:readme.htm
readme=:README.txt
readme=:readme.txt
readme=:README
readme=:readme
readme=:INSTALL.md
readme=:install.md
readme=:INSTALL.mkd
readme=:install.mkd
readme=:INSTALL.rst
readme=:install.rst
readme=:INSTALL.html
readme=:install.html
readme=:INSTALL.htm
readme=:install.htm
readme=:INSTALL.txt
readme=:install.txt
readme=:INSTALL
readme=:install
##
## List of repositories.
## PS: Any repositories listed when section is unset will not be
## displayed under a section heading
## PPS: This list could be kept in a different file (e.g. '/etc/cgitrepos')
## and included like this:
## include=/etc/cgitrepos
##
repo.url=foo
repo.path=/pub/git/foo.git
repo.desc=the master foo repository
repo.owner=fooman@example.com
repo.readme=info/web/about.html
repo.url=bar
repo.path=/pub/git/bar.git
repo.desc=the bars for your foo
repo.owner=barman@example.com
repo.readme=info/web/about.html
# The next repositories will be displayed under the 'extras' heading
section=extras
repo.url=baz
repo.path=/pub/git/baz.git
repo.desc=a set of extensions for bar users
repo.url=wiz
repo.path=/pub/git/wiz.git
repo.desc=the wizard of foo
# Add some mirrored repositories
section=mirrors
repo.url=git
repo.path=/pub/git/git.git
repo.desc=the dscm
repo.url=linux
repo.path=/pub/git/linux.git
repo.desc=the kernel
# Disable adhoc downloads of this repo
repo.snapshots=0
# Disable line-counts for this repo
repo.enable-log-linecount=0
# Restrict the max statistics period for this repo
repo.max-stats=month
see how it all just flows? β¨ global settings at the top, then the per-repo blocks stacked at the bottom, section= dropping in to group them like a little vibe check, and a handful of repo. overrides sniping individual repos at the very end. iconic behaviour, no notes π
π BUGS π
ngl this one's a real one. comments cannot currently appear on the same line as a setting β the comment doesn't get stripped out, it gets swallowed into the value π. So this line:
robots=index # allow indexing
will generate the following html element:
<meta name='robots' content='index # allow indexing'/>
yeah. the whole # allow indexing is just in there now, living inside your html attribute π« . keep your comments on their own dang line, bestie, that's the move.
π AUTHOR π
- Lars Hjemli
<hjemli@gmail.com> - Jason A. Donenfeld
<Jason@zx2c4.com>
and that's a wrap on CGITRC(5) π this page came from cgit, dated 10/04/2026 β go forth and configure, my gorgeous little sysadmin π¦π
periodt.
π¦ where this page comes from
- ubuntu stonking: cgit 1.3.1+git2.54.0-1 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms