auto add .git suffix, deny name with a slash
This commit is contained in:
parent
99e2c68589
commit
960caab149
19
newrepo
19
newrepo
|
@ -1,4 +1,15 @@
|
|||
#!/bin/sh
|
||||
mkdir -p ~/$1
|
||||
cd ~/$1
|
||||
git init --bare
|
||||
#!/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}
|
||||
|
|
Loading…
Reference in a new issue