# info > GITWEB.CONF

---
type: CommandReference
command: gitweb.conf
mode: man
section: 5
source: man-pages
---

## Quick Reference
- `our $projectroot = "/srv/git";` — set root directory for Git repositories
- `our $site_name = "My Git Repos";` — title shown in browser tab and header
- `$feature{'blame'}{'default'} = [1];` — enable blame view (CPU‑intensive)
- `$feature{'snapshot'}{'default'} = ['tgz', 'zip'];` — offer tar.gz and zip snapshots
- `$feature{'highlight'}{'default'} = [1];` — enable syntax highlighting (requires `highlight`)
- `$feature{'grep'}{'default'} = [1];` — enable grep search (default on)
- `$feature{'avatar'}{'default'} = ['gravatar'];` — show committer avatars
- `$projects_list_group_categories = 1;` — group projects by category on index page

## Name
`gitweb.conf` — Gitweb (Git web interface) configuration file

## Synopsis
perl
/etc/gitweb.conf
/etc/gitweb-common.conf
$GITWEBDIR/gitweb_config.perl
## Configuration Variables

### Location of repositories
- `$projectroot` — absolute filesystem path prepended to project path; e.g. `/srv/git`
- `$projects_list` — plain text file listing projects, or directory scanned for projects; default from `GITWEB_LIST`
- `$project_maxdepth` — recursion depth limit for scanning `$projectroot`; default 2007
- `$export_ok` — only show repository if this file exists inside it (e.g. `git-daemon-export-ok`)
- `$export_auth_hook` — subroutine returning true to include a project; receives full path
- `$strict_export` — only allow direct access to repositories listed on the overview page

### Finding files
- `$GIT` — path to core Git executable; default `$GIT_BINDIR/git`; must be set
- `$mimetypes_file` — file for MIME type guessing; unset uses only `/etc/mime.types`
- `$highlight_bin` — path to `highlight` for syntax highlighting; default `highlight`

### Links and their targets
- `@stylesheets` — list of stylesheet URIs relative to gitweb base URI
- `$logo` — URI of logo image (72x27); default `static/git-logo.png`
- `$favicon` — URI of favicon; default `static/git-favicon.png`
- `$javascript` — URI of JavaScript file; default `static/gitweb.js`
- `$home_link` — target of the home link; default current page URI
- `$home_link_str` — label for home link; default `"projects"`
- `@extra_breadcrumbs` — array of `[label, url]` added before home link in breadcrumb trail
- `$logo_url`, `$logo_label` — link and tooltip for logo; default Git homepage

### Changing gitweb’s look
- `$site_name` — site name in page titles; default from `SERVER_NAME` or `"Untitled Git"`
- `$site_html_head_string` — HTML snippet inserted into `<head>`
- `$site_header` / `$site_footer` — files with HTML included at top/bottom of each page
- `$home_text` — HTML file included on projects list page; default `indextext.html`
- `$projects_list_description_width` — width of description column; default 25
- `$default_projects_order` — default sort: `"none"`, `"project"`, `"descr"`, `"owner"`, `"age"`

### Changing gitweb’s behavior
- `$default_blob_plain_mimetype` — default MIME type for raw view; default `"text/plain"`
- `$default_text_plain_charset` — default charset for text files; unset uses server config
- `$fallback_encoding` — encoding used when UTF‑8 decoding fails; default `"latin1"`
- `@diff_opts` — rename detection options for diff; default `('-M')`

### Optional features and policies
- `@git_base_url_list` — list of base URLs for constructing fetch URLs
- `$projects_list_group_categories` — enable grouping by category; default 0
- `$project_list_default_category` — default category for projects without one; default `""`
- `$prevent_xss` — disable features that may allow XSS; default 0
- `$maxload` — refuse requests when system load average exceeds this; default 300
- `$omit_age_column` / `$omit_owner` — hide age column / owner info; default false
- `$per_request_config` — code reference run once per request; default 1 (true)

### Other variables
- `$version` — gitweb version string; set automatically
- `$my_url`, `$my_uri` — full and absolute URL of gitweb script; usually auto‑detected
- `$base_url` — base URL for relative links; usually auto‑detected

## Configuring gitweb features
Features are stored in the `%feature` hash. Each entry has:
- `default` — list of options (turns feature on/off)
- `override` — boolean; if true, per‑repository config overrides
- `sub` — internal (only needed for overridable features)

### Overridable features
- `blame` — enable blame view; default `[0]`; per‑repo: `gitweb.blame`
- `snapshot` — enable snapshot downloads; default `['tgz']`; per‑repo: `gitweb.snapshot`
- `grep` — enable grep search; default `[1]`; per‑repo: `gitweb.grep`
- `pickaxe` — enable pickaxe search; default `[1]`; per‑repo: `gitweb.pickaxe`
- `show-sizes` — show blob sizes in tree view; default `[1]`; per‑repo: `gitweb.showSizes`
- `patches` — enable patches view, max patches; default `[16]`; per‑repo: `gitweb.patches`
- `avatar` — show avatar; default `['gravatar']`; per‑repo: `gitweb.avatar`
- `email-privacy` — redact e‑mail addresses; default `[0]`; per‑repo: `gitweb.email-privacy`
- `highlight` — server‑side syntax highlight; default `[0]`; per‑repo: `gitweb.highlight`
- `remote_heads` — show remote‑tracking branches; default `[0]`; per‑repo: `gitweb.remote_heads`

### Non‑overridable features
- `search` — enable text search; default `[1]`
- `forks` — treat subdirectories as forks; default `[0]`
- `actions` — custom links in action bar; default `[]`
- `timed` — show page generation time; default `[0]`
- `javascript-timezone` — timezone selection via JavaScript; default `['local', 'gitweb_tz', 'datetime']`
- `extra-branch-refs` — list of extra ref directories under `refs/`; default `[]`

## Examples
Enable blame, pickaxe, and snapshots (tar.gz + zip), with per‑repo override:
perl
$feature{'blame'}{'default'} = [1];
$feature{'blame'}{'override'} = 1;

$feature{'pickaxe'}{'default'} = [1];
$feature{'pickaxe'}{'override'} = 1;

$feature{'snapshot'}{'default'} = ['zip', 'tgz'];
$feature{'snapshot'}{'override'} = 1;
Disable zip snapshots and set gzip compression level:
perl
$known_snapshot_formats{'zip'}{'disabled'} = 1;
$known_snapshot_formats{'tgz'}{'compressor'} = ['gzip','-6'];
Add a custom action link:
perl
$feature{'actions'}{'default'} =
    [ ('graphiclog', '/git-browser/by-commit.html?r=%n', 'summary') ];
## See Also
- [gitweb(1)](http://localhost/phpMan.php/man/gitweb/1/markdown)
- [git-instaweb(1)](http://localhost/phpMan.php/man/git-instaweb/1/markdown)
- `gitweb/README`, `gitweb/INSTALL`