git-shell-commands/newrepo

16 lines
324 B
Bash
Executable file

#!/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 --template=git-templates ${repo_name} 1>/dev/null