Created
August 11, 2011 12:20
-
-
Save gyulalaszlo/1139514 to your computer and use it in GitHub Desktop.
create an empty git repo at /git/<repo>.git
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment