cleaning
This commit is contained in:
Executable
+48
@@ -0,0 +1,48 @@
|
||||
#!/bin/bash
|
||||
|
||||
# ---------------------
|
||||
# user "git" owned remote repository
|
||||
#
|
||||
# must run on remote server
|
||||
# change HostName and RemoteName
|
||||
# ---------------------
|
||||
# R e s u l t E x a m p l e:
|
||||
# sudo bash -c 'mkdir /opt/store/git/cvtt2/tests.git && cd /opt/store/git/cvtt2/tests.git && git init --bare && chown -R git:git /opt/store/git/cvtt2/tests.git'
|
||||
# ---------------------
|
||||
#
|
||||
|
||||
# ----- S e t t i n g s
|
||||
HostName=cloud21.cvtt.vpn
|
||||
RemoteName=origin
|
||||
# ----- S e t t i n g s
|
||||
|
||||
usage() {
|
||||
echo "Usage: ${0} <repo_name> [<repo_parent_dir> */opt/store/git/cvtt2]"
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
||||
RepoName=${1}
|
||||
if [ "" == "${RepoName}" ] ; then
|
||||
usage
|
||||
fi
|
||||
|
||||
RepoParentDir=/opt/store/git/cvtt2
|
||||
if [ "${2}" != "" ] ; then
|
||||
RepoParentDir=${2}
|
||||
fi
|
||||
|
||||
RepoDir="${RepoParentDir}/${RepoName}.git"
|
||||
|
||||
|
||||
Cmd="sudo bash -c 'mkdir ${RepoDir}"
|
||||
Cmd="${Cmd} && cd ${RepoDir}"
|
||||
Cmd="${Cmd} && git init --bare "
|
||||
Cmd="${Cmd} && chown -R git:git ${RepoDir}'"
|
||||
echo ${Cmd}
|
||||
eval ${Cmd} || exit 1
|
||||
|
||||
echo "====================="
|
||||
echo "Repository is created. Use this command to add it:"
|
||||
echo " git remote add ${RemoteName} git@${HostName}:${RepoDir}"
|
||||
echo "====================="
|
||||
Reference in New Issue
Block a user