commit 6f24f2aefc8c04057ba1ab5b12b47523749293a2 parent 1729a877781e022c2ddb28c5126b901e40cc9215 Author: Julian Piribauer <julian@Julians-Air.fritz.box> Date: Mon, 16 Feb 2026 21:14:50 +0100 Initial commit of stagit doc Diffstat:
| A | stagit.md | | | 46 | ++++++++++++++++++++++++++++++++++++++++++++++ |
1 file changed, 46 insertions(+), 0 deletions(-)
diff --git a/stagit.md b/stagit.md @@ -0,0 +1,46 @@ +# Static git server + +We give the user git the home: /srv/git and store the repos as /srv/git/repos/my_repo. +The web server has its root at /var/www/git/. + +First, we create a helper script: + +/usr/local/bin/update-stagit.sh: + + #!/bin/sh + set -eu + + REPO_PATH="$1" + REPO_NAME="$(basename "$REPO_PATH" .git)" + + HTML_ROOT="/var/www/git" + REPO_HTML="$HTML_ROOT/$REPO_NAME" + REPO_ROOT="/srv/git/repos" + + mkdir -p "$REPO_HTML" + + # Generate repo pages + cd "$REPO_HTML" + stagit "$REPO_PATH" + + # Regenerate global index + cd "$HTML_ROOT" + stagit-index "$REPO_ROOT"/*.git > index.html + +make it executable: +chmod +x /usr/local/bin/update-git.sh + +We now set up a post-receive hook that creates the folder structure for new repos. +/srv/git/template/hooks/post-receive: + + #!/bin/sh + /usr/local/bin/update-stagit.sh "$(pwd)" + +Make it executable with chmod +. + +Instruct git to use it as a template: +git config --system init.templateDir /srv/git/template + +Finally, we give all users reading rights to all subfolders of the repo folders: +chmod -R a+rX /srv/git/repos +chmod -R a+rX /var/www/git