Created
May 30, 2012 01:38
-
-
Save kellyredding/2832399 to your computer and use it in GitHub Desktop.
mkgit
This file contains hidden or 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
#!/bin/bash | |
if [ -z $1 ]; then | |
echo "usage: mkgit project-name project-description" | |
else | |
gitdir="/srv/repos/$1.git" | |
if [ -d $gitdir ]; then | |
echo "error: the repo '$gitdir' already exists." | |
else | |
# create a bare repo w/ name and desc | |
mkdir -p -m 775 $gitdir | |
pushd $gitdir | |
git --bare init | |
echo $2 | tee description | |
popd | |
# show instructions for pushing to it (ripped from Github's) | |
echo "Next steps:" | |
echo " mkdir "$1 | |
echo " cd "$1 | |
echo " git init" | |
echo " touch README" | |
echo " git add README" | |
echo " git commit -m 'first commit'" | |
echo " git remote add origin <your-origin>/"$1".git" | |
echo " git push -u origin master" | |
echo "Existing Git Repo?" | |
echo " cd existing_git_repo" | |
echo " git remote add origin <your-origin>/"$1".git" | |
echo " git push -u origin master" | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment