All-in-one Git hosting container
git clone git://git.janzachar.dev/git-serv.git
0#!/bin/sh123#shellcheck source=config/env4. "/srv/config/env"56usage() {7 echo "usage: init <name>"8 echo " initializes a new repo with the given name"9 echo " example: init test"10 exit 111}1213[ $# -ne 1 ] && usage1415REPO="/repos/${1}.git"1617[ -d "$REPO" ] && {18 echo "'${1}' already exists!"19 exit 120}2122git init -q --bare --initial-branch=main "$REPO"23touch "$REPO"/git-daemon-export-ok # Repos are public by default2425cat<< EOF > "$REPO"/hooks/post-update26#!/bin/sh2728git show-ref --heads 2>&12930SRC=/repos \31BUILD=/srv/pages \32python3 /srv/spgit/src/main.py >> /log/spgit 2>> /log/spgit33EOF34chmod +x "$REPO"/hooks/post-update353637echo "repo created! Clone it with"38echo " git clone $(./git-shell-commands/link "$1")"3940