newrepo (564B) [raw]
1 #!/bin/sh 2 set -e 3 die() { 4 echo "$*" 1>&2 5 exit 1 6 } 7 [ -z "$1" ] && die "usage: newrepo NAME" 8 9 [ ! -e "$HOME/git" ] && ln -sf "/var/git/$USER" "$HOME/git" 10 11 NAME="$1" 12 REPO="$HOME/git/${NAME}.git" 13 14 git init --bare "$REPO" 15 echo "$USER" > "${REPO}/owner" 16 echo "git://git.garbash.com/${USER}/${NAME}" > "$REPO/url" 17 touch "$REPO/git-daemon-export-ok" 18 19 printf "description: " 20 read desc 21 echo "$desc" > "$REPO/description" 22 23 cp /var/git/stagit-post-receive "$REPO/hooks/post-receive" 24 25 echo "" 26 echo "Done! Clone with:" 27 echo " git clone ${USER}@git.garbash.com:git/${NAME}.git"