
Untitled
By: a guest on
May 9th, 2012 | syntax:
None | size: 0.75 KB | hits: 11 | expires: Never
#/usr/bin/env bash
# Create a git repo in the root git dir, and grant ownership to this user
if [ -z $1 ]
then
echo "Usage: $0 <repo name> [checkout_path]"
echo "Missing repo name"
exit $E_MISSING_POS_PARAM
fi
GIT_ROOT="/git"
GIT_REPO_PATH="$GIT_ROOT/$1.git"
TARGET_GROUP="git"
echo "--> Create repo directory $GIT_REPO_PATH"
sudo mkdir -p $GIT_REPO_PATH
echo "--> change owner of directory to $USER:$TARGET_GROUP"
sudo chown $USER:$TARGET_GROUP $GIT_REPO_PATH
echo "--> Init bare repo in $GIT_REPO_PATH"
cd $GIT_REPO_PATH
git init --bare
echo
echo
echo
echo "Created repo $GIT_REPO_PATH"
echo "-------------------------------------"
echo "push to this repo by"
echo "git remote add <remote_name> ssh://$USER@<machine>$GIT_REPO_PATH"
cd $HOME