A tiny read-only git web frontend — browse bare repos with just PHP and git, no database, no framework.
#!/bin/sh
# usage (over ssh, as the git user): ssh git@<host> delete <reponame> <reponame>
#
# Permanently deletes a bare repo under $reposdir. Irreversible, so as a guard
# against a stray typo the name must be given twice -- both must match exactly
# or nothing is deleted. Paths below must match server/setup-server.sh.
reposdir="/var/git/repos"
name="$1"
confirm="$2"
if [ -z "$name" ] || [ -z "$confirm" ]; then
echo "usage: delete <reponame> <reponame> (name given twice, as confirmation)" >&2
exit 1
fi
name=$(basename "$name" ".git")
confirm=$(basename "$confirm" ".git")
if [ "$name" != "$confirm" ]; then
echo "repo name mismatch -- nothing deleted" >&2
exit 1
fi
case "$name" in
*/* | .* | -*)
echo "invalid repo name: $name" >&2
exit 1
;;
esac
dest="${reposdir}/${name}.git"
if [ ! -d "$dest" ]; then
echo "no such repo: ${name}.git" >&2
exit 1
fi
rm -rf -- "$dest"
echo "deleted repos/${name}.git"