This project is a fork of alpine-cgit and will be independently maintained going forward. The primary repository is hosted at cnb.cool/mmdjiji/cgit — please submit all issues and pull requests there. The GitHub repository is a read-only mirror.
English | 简体中文
The hyperfast web frontend for Git repositories on top of Alpine and Nginx. CGit is a web interface (cgi) for Git repositories, written in C.
- Basic repository browsing (logs, diffs, trees...).
- Caching of generated HTML.
- Cloneable URLs (implements dumb HTTP transport).
- Commit feeds (atom format).
- Discovery of Git repositories.
- On-the-fly archives for tags and commits.
- Plugin support e.g. syntax highlighting.
- Side-by-side diffs.
- Simple time/author statistics.
- Simple virtual hosting support (macro expansion).
- Understands GitWeb project-lists.
- Understands
gitweb.ownerin Git config files. - Has an extensive filtering framework using scripts or a built-in Lua interpreter.
- Optional HTTP Basic Auth support.
- Git LFS online preview support.
- Rich theme support.
docker run -itd --name cgit -p 8787:80 -v $PWD/repos:/srv/git/ ghcr.io/mmdjiji/cgit:latestDockerfile
FROM ghcr.io/mmdjiji/cgit:latest/etc/cgitrc: Default CGit configuration file./srv/git: Default directory for Git repositories scanned by CGit./var/cache/cgit: Default CGit caching directory of generated HTML.
Note that all these paths can be overwritten via Bind Mounts or Docker Volumes.
CGit Docker image can be configured via environment variables. This is the default behavior.
CGIT_TITLE: Website title.CGIT_DESC: Website description.CGIT_VROOT: Virtual root directory.CGIT_SECTION_FROM_STARTPATH: How many path elements from each repo path to use as a default section name.CGIT_MAX_REPO_COUNT: Number of entries to list per page on the repository index page. Default:50.CGIT_THEME: Default visual theme. Default:default.
Users can also switch themes at runtime via a dropdown in the page header; their choice is saved in the browser.
| Value | Description |
|---|---|
default |
Classic CGit appearance |
cgithub-auto |
GitHub-inspired theme, follows OS light/dark preference |
cgithub-light |
GitHub-inspired theme, always light |
cgithub-dark |
GitHub-inspired theme, always dark |
HTTP Basic Auth can be enabled by setting both BASIC_AUTH_USER and BASIC_AUTH_PASS. If either is unset, authentication is disabled.
BASIC_AUTH_USER: Username for HTTP Basic Auth.BASIC_AUTH_PASS: Password for HTTP Basic Auth.
This applies to both the web interface and git clone over HTTP:
git clone https://admin:12345678@your-host/repo-nameYou can replace the default logo and favicon by mounting your own image files into the container:
volumes:
- ./logo.png:/usr/share/webapps/cgit/cgit.png:ro
- ./logo.ico:/usr/share/webapps/cgit/favicon.ico:ro| Mount target | Description |
|---|---|
/usr/share/webapps/cgit/cgit.png |
Site logo displayed in the page header |
/usr/share/webapps/cgit/favicon.ico |
Browser tab favicon |
Tip: For best results, use a square image. The favicon is typically displayed at 16x16 or 32x32 pixels — converting to
.icoformat is recommended for maximum browser compatibility.
By default, this Docker image will use a template file located at cgit.conf which is replaced with the env settings (mentioned above) at start-up time.
However, if you want to use a custom /etc/cgitrc file then follow these steps:
- Provide the env variable
USE_CUSTOM_CONFIG=trueto prevent using the default config file. - Provide the custom config file as a Bind Mount or Docker Volume. For example
--volume my-config-file:/etc/cgitrc - Provide the
cache-rootoption in your config file. For examplecache-root=/var/cache/cgit - Provide the
scan-pathoption in your config file. For examplescan-path=/srv/git - Provide the repositories folder as a Bind Mount or Docker Volume. For example
--volume my-repos:/srv/git
See cgitrc man page for more detailed information.
This project is maintained at cnb.cool/mmdjiji/cgit. The GitHub repository is a read-only mirror. Please submit all Pull Requests and Issues on CNB.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in current work by you, as defined in the Apache-2.0 license, shall be dual licensed as described below, without any additional terms or conditions.
This work is primarily distributed under the terms of both the MIT license and the Apache License (Version 2.0).
- © 2021-2026 Jose Quintana
- © 2026-present JiJi
