From 5b43d57712450c0c864cba3a24ae06cd07b23375 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Tue, 3 Nov 2026 22:57:55 -1000 Subject: Say to run the cache hook as the web server The header asked for write access for the pushing user, but MANUAL.txt keeps the cache root at mode 0700 for the web server and cgit writes its slots at 0600, so a pusher could at best drop every page rather than only its own. --- custom/hooks/post-receive.cgit-cache | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'custom') diff --git a/custom/hooks/post-receive.cgit-cache b/custom/hooks/post-receive.cgit-cache index 61ac1ea..8aae60b 100755 --- a/custom/hooks/post-receive.cgit-cache +++ b/custom/hooks/post-receive.cgit-cache @@ -17,10 +17,14 @@ # the whole cache goes, as the safe choice. # # The path below is the default cache-root, so a cgitrc that changes the -# setting needs the same change here. The web server owns the cache root, so -# the pushing user needs write access to it. Nothing here complains or exits -# non-zero when that access is missing, so the pusher is not shown an error -# over a stale page. +# setting needs the same change here. The cache root belongs to the account the +# web server runs cgit as, with mode 0700, and so do the files cgit writes +# there, so the hook has to run as that account to read and remove them. A push +# the same web server takes through git-http-backend runs hooks as that account +# already. For a push over ssh, run the hook through sudo -u with that account, +# keeping GIT_DIR so that git still trusts a repository the account does not +# own. Nothing here complains or exits non-zero when that access is missing, so +# the pusher is not shown an error over a stale page. # # To install the hook, copy or link it to hooks/post-receive in each # repository. Git runs one post-receive per repository, so fold this together -- cgit 2.12.1