# cgit — Configuration Reference ## Configuration File Default location: `/etc/cgitrc` (compiled in as `CGIT_CONFIG`). Override at runtime by setting the `$CGIT_CONFIG` environment variable. ## File Format The configuration file uses a simple `name=value` format, parsed by `parse_configfile()` in `configfile.c`. Key rules: - Lines starting with `#` or `;` are comments - Leading whitespace on lines is skipped - No quoting mechanism — the value is everything after the `=` to end of line - Empty lines are ignored - Nesting depth for `include=` directives is limited to 8 levels ```c int parse_configfile(const char *filename, configfile_value_fn fn) { static int nesting; /* ... */ if (nesting > 8) return -1; /* ... */ while (read_config_line(f, &name, &value)) fn(name.buf, value.buf); /* ... */ } ``` ## Global Directives All global directives are processed by `config_cb()` in `cgit.c`. When a directive is encountered, the value is stored in the corresponding `ctx.cfg.*` field. ### Site Identity | Directive | Default | Type | Description | |-----------|---------|------|-------------| | `root-title` | `"Git repository browser"` | string | HTML page title for the index page | | `root-desc` | `"a fast webinterface for the git dscm"` | string | Subtitle text on the index page | | `root-readme` | (none) | path | Path to a file rendered on the site about page | | `root-coc` | (none) | path | Path to Code of Conduct file | | `root-cla` | (none) | path | Path to Contributor License Agreement file | | `root-homepage` | (none) | URL | External homepage URL | | `root-homepage-title` | (none) | string | Title text for the homepage link | | `root-link` | (none) | string | `label\|url` pairs for navigation links (can repeat) | | `logo` | `"/cgit.png"` | URL | Path to the site logo image | | `logo-link` | (none) | URL | URL the logo links to | | `favicon` | `"/favicon.ico"` | URL | Path to the favicon | | `css` | (none) | URL | Stylesheet URL (can repeat for multiple stylesheets) | | `js` | (none) | URL | JavaScript URL (can repeat) | | `header` | (none) | path | File included at the top of every page | | `footer` | (none) | path | File included at the bottom of every page | | `head-include` | (none) | path | File included in the HTML `
` | | `robots` | `"index, nofollow"` | string | Content for `` | ### URL Configuration | Directive | Default | Type | Description | |-----------|---------|------|-------------| | `virtual-root` | (none) | path | Base URL path when using URL rewriting (always ends with `/`) | | `script-name` | `CGIT_SCRIPT_NAME` | path | CGI script name (from `$SCRIPT_NAME` env var) | | `clone-prefix` | (none) | string | Prefix for clone URLs when auto-generating | | `clone-url` | (none) | string | Clone URL template (`$CGIT_REPO_URL` expanded) | When `virtual-root` is set, URLs use path-based routing: `/cgit/repo/log/path`. Without it, query-string routing is used: `?url=repo/log/path`. ### Feature Flags | Directive | Default | Type | Description | |-----------|---------|------|-------------| | `enable-http-clone` | `1` | int | Allow HTTP clone operations (HEAD, info/refs, objects/) | | `enable-index-links` | `0` | int | Show log/tree/commit links on the repo index page | | `enable-index-owner` | `1` | int | Show the Owner column on the repo index page | | `enable-blame` | `0` | int | Enable blame view for all repos | | `enable-commit-graph` | `0` | int | Show ASCII commit graph in log view | | `enable-log-filecount` | `0` | int | Show changed-file count in log view | | `enable-log-linecount` | `0` | int | Show added/removed line counts in log | | `enable-remote-branches` | `0` | int | Display remote tracking branches | | `enable-subject-links` | `0` | int | Show parent commit subjects instead of hashes | | `enable-html-serving` | `0` | int | Serve HTML files as-is from plain view | | `enable-subtree` | `0` | int | Detect and display git-subtree directories | | `enable-tree-linenumbers` | `1` | int | Show line numbers in file/blob view | | `enable-git-config` | `0` | int | Read `gitweb.*` and `cgit.*` from repo's git config | | `enable-filter-overrides` | `0` | int | Allow repos to override global filters | | `enable-follow-links` | `0` | int | Show "follow" links in log view for renames | | `embedded` | `0` | int | Omit HTML boilerplate for embedding in another page | | `noheader` | `0` | int | Suppress the page header | | `noplainemail` | `0` | int | Hide email addresses in output | | `local-time` | `0` | int | Display times in local timezone instead of UTC | ### Limits | Directive | Default | Type | Description | |-----------|---------|------|-------------| | `max-repo-count` | `50` | int | Repos per page on the index (≤0 → unlimited) | | `max-commit-count` | `50` | int | Commits per page in log view | | `max-message-length` | `80` | int | Truncate commit subject at this length | | `max-repodesc-length` | `80` | int | Truncate repo description at this length | | `max-blob-size` | `0` | int (KB) | Max blob size to display (0 = unlimited) | | `max-stats` | `0` | int | Stats period (0=disabled, 1=week, 2=month, 3=quarter, 4=year) | | `max-atom-items` | `10` | int | Number of entries in Atom feeds | | `max-subtree-commits` | `2000` | int | Max commits to scan for subtree trailers | | `renamelimit` | `-1` | int | Diff rename detection limit (-1 = Git default) | ### Caching | Directive | Default | Type | Description | |-----------|---------|------|-------------| | `cache-size` | `0` | int | Number of cache entries (0 = disabled) | | `cache-root` | `CGIT_CACHE_ROOT` | path | Directory for cache files | | `cache-root-ttl` | `5` | int (min) | TTL for repo-list pages | | `cache-repo-ttl` | `5` | int (min) | TTL for repo-specific pages | | `cache-dynamic-ttl` | `5` | int (min) | TTL for dynamic content | | `cache-static-ttl` | `-1` | int (min) | TTL for static content (-1 = forever) | | `cache-about-ttl` | `15` | int (min) | TTL for about/readme pages | | `cache-snapshot-ttl` | `5` | int (min) | TTL for snapshot pages | | `cache-scanrc-ttl` | `15` | int (min) | TTL for cached scan-path results | ### Sorting | Directive | Default | Type | Description | |-----------|---------|------|-------------| | `case-sensitive-sort` | `1` | int | Case-sensitive repo name sorting | | `section-sort` | `1` | int | Sort sections alphabetically | | `section-from-path` | `0` | int | Derive section name from path depth (>0 = from start, <0 = from end) | | `repository-sort` | `"name"` | string | Default sort field for repo list | | `branch-sort` | `0` | int | Branch sort: 0=name, 1=age | | `commit-sort` | `0` | int | Commit sort: 0=default, 1=date, 2=topo | ### Snapshots | Directive | Default | Type | Description | |-----------|---------|------|-------------| | `snapshots` | (none) | string | Space-separated list of enabled formats: `.tar` `.tar.gz` `.tar.bz2` `.tar.lz` `.tar.xz` `.tar.zst` `.zip`. Also accepts `all`. | ### Filters | Directive | Default | Type | Description | |-----------|---------|------|-------------| | `about-filter` | (none) | filter | Filter for rendering README/about content | | `source-filter` | (none) | filter | Filter for syntax highlighting source code | | `commit-filter` | (none) | filter | Filter for commit messages | | `email-filter` | (none) | filter | Filter for email display (2 args: email, page) | | `owner-filter` | (none) | filter | Filter for owner display | | `auth-filter` | (none) | filter | Authentication filter (12 args) | Filter values use the format `type:command`: - `exec:/path/to/script` — external process filter - `lua:/path/to/script.lua` — Lua script filter - Plain path without prefix defaults to `exec` ### Display | Directive | Default | Type | Description | |-----------|---------|------|-------------| | `summary-branches` | `10` | int | Branches shown on summary page | | `summary-tags` | `10` | int | Tags shown on summary page | | `summary-log` | `10` | int | Log entries shown on summary page | | `side-by-side-diffs` | `0` | int | Default to side-by-side diff view | | `remove-suffix` | `0` | int | Remove `.git` suffix from repo URLs | | `scan-hidden-path` | `0` | int | Include hidden dirs when scanning | ### Miscellaneous | Directive | Default | Type | Description | |-----------|---------|------|-------------| | `agefile` | `"info/web/last-modified"` | path | File in repo checked for modification time | | `mimetype-file` | (none) | path | Apache-style mime.types file | | `mimetype.