git-shell-commands/newrepo

16 lines
287 B
Plaintext
Raw Normal View History

#!/bin/bash
repo_name="$1"
if [[ $repo_name =~ ^.*/$ ]] ; then
echo "Failed to create new repository."
echo "Don't place a slash after repository's name"
exit 1
fi
if [[ ! $repo_name =~ ^.*\.git$ ]] ; then
repo_name="${repo_name}.git"
fi
git init --bare ${repo_name}