1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#!/bin/sh # * create-bare-repo # Allows users to create repo.git # ssh git@host create-bare-repo repo1 repo2 ... set -e for repo in $@; do # Cleanup names, allow hidden repos repo="`echo "$repo" | sed -e "s/\.\.//g" -e "s,^/\+,,g" -e "s,[^a-z0-9\./_-],,gi"`" test -d "$repo".git && continue mkdir -p "$repo".git pushd "$repo".git git init --bare popd done