summaryrefslogtreecommitdiff
path: root/git-shell-commands/create-bare-repo
blob: a6e49e39c93b04c72030c12faf26b9d2e3289415 (plain)
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
    repo="`echo "$repo" | sed -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