diff options
| author | delusionalai <delusionalai@jnsn.dev> | 2026-11-15 13:08:13 +0000 |
|---|---|---|
| committer | delusionalai <delusionalai@jnsn.dev> | 2026-11-15 13:08:13 +0000 |
| commit | cad3e5f4dff0c77c8eed020308c5bf8ffbff5964 (patch) | |
| tree | 9ee141615506cd54f37b0cac480cf2182d8a31fc | |
| parent | 8eeb7af73c5fed13446ff1df90061cbd8f3effb9 (diff) | |
| download | git-host-cad3e5f4dff0c77c8eed020308c5bf8ffbff5964.tar.gz git-host-cad3e5f4dff0c77c8eed020308c5bf8ffbff5964.zip | |
Move repo-scoped cgit settings above scan-path
cgit processes scan-path at the point it appears in the config file and
every repository it discovers snapshots the current global settings at
that moment (repo_prepare()). Anything placed below scan-path was
silently ignored for scanned repositories -- clone-url was, which is why
the interface showed no clone URLs at all.
Move all repo-scoped settings above scan-path and fix the templates:
- clone-url is a single setting holding a space-separated list; repeating
the key overwrites rather than appends
- $HTTP_HOST carries the port, which is right for the http URL but would
yield host:8080:2222 for ssh, so ssh uses port-free $SERVER_NAME
- the ssh path must be "~/..." because git-shell jails the git user to
its home and an ssh:// path is taken as absolute
- remove-suffix=1 strips ".git" from $CGIT_REPO_URL, so re-append it to
keep the advertised URLs directly cloneable
This also restores enable-log-filecount, enable-log-linecount,
enable-commit-graph, max-stats, snapshots and about-filter for scanned
repos, and activates remove-suffix (browse URLs lose the ".git" suffix).
| -rw-r--r-- | cgitrc | 46 |
1 files changed, 39 insertions, 7 deletions
@@ -1,18 +1,50 @@ +# --------------------------------------------------------------------------- +# Global-only settings. These apply to cgit itself and are not snapshotted per +# repository, so their position in this file does not matter. +# --------------------------------------------------------------------------- css=/cgit.css logo=/cgit.png favicon=/favicon.ico -scan-path=/var/lib/git -remove-suffix=1 -enable-http-clone=1 -snapshots=tar.gz zip root-title=Repositories root-desc=Simple Git host +virtual-root=/cgit/ +mimetype-file=/etc/mime.types +remove-suffix=1 section-from-path=1 -clone-url=ssh://git@$HTTP_HOST:$CGIT_REPO_URL +enable-http-clone=1 + +# --------------------------------------------------------------------------- +# Repository-scoped settings. +# +# IMPORTANT: these MUST stay above scan-path. cgit processes scan-path at the +# point it appears in the config file, and every repository it discovers +# snapshots the current global settings at that moment (see cgit's +# repo_prepare()). Anything placed after scan-path is silently ignored for +# scanned repositories -- that is exactly how the clone URLs stopped showing up. +# +# clone-url is a single setting holding a space-separated list of templates; +# repeating the key would overwrite rather than append. +# +# $HTTP_HOST keeps the port the browser used, which is right for the http URL but +# wrong for ssh (it would yield host:8080:2222), so the ssh URL uses the +# port-free $SERVER_NAME plus the sshd port from sshd_config. +# +# The ssh path is "~/..." on purpose: git-shell jails the git user to its home +# (/var/lib/git), and an ssh:// URL path is taken as an absolute path, so a bare +# "/demo.git" fails with "does not appear to be a git repository". +# +# remove-suffix=1 strips the ".git" suffix from $CGIT_REPO_URL, so the suffix is +# re-appended here to keep the advertised URLs directly cloneable. +# --------------------------------------------------------------------------- +clone-url=ssh://git@$SERVER_NAME:2222/~/$CGIT_REPO_URL.git http://$HTTP_HOST/git/$CGIT_REPO_URL.git +snapshots=tar.gz zip about-filter=/usr/lib/cgit/filters/about-formatting.sh enable-log-filecount=1 enable-log-linecount=1 enable-commit-graph=1 max-stats=quarter -virtual-root=/cgit/ -mimetype-file=/etc/mime.types + +# --------------------------------------------------------------------------- +# Repository discovery. Keep this last so every setting above is inherited. +# --------------------------------------------------------------------------- +scan-path=/var/lib/git |
