Created
May 7, 2009 21:24
-
-
Save sansumbrella/108398 to your computer and use it in GitHub Desktop.
Bash script to create and initialize a git repo on a dreamhost server
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
#Based on: | |
#http://casperfabricius.com/site/2008/09/21/keeping-git-repositories-on-dreamhost-using-ssh/ | |
DREAMGIT_DOMAIN=you@yourhost.dreamhost.com | |
GIT_DOMAIN=whatever.you.want | |
DH_USER=home/yourusername | |
YEAR=`eval date +%Y` | |
#set up on the server | |
ssh $DREAMGIT_DOMAIN 'mkdir -p '$GIT_DOMAIN'/'$YEAR'/'$1'.git && cd '$GIT_DOMAIN'/'$YEAR'/'$1'.git && git --bare init' | |
#set up locally | |
mkdir $1 | |
cd $1 | |
git init | |
#associate with server | |
git remote add origin ssh://$DREAMGIT_DOMAIN/$DH_USER/$GIT_DOMAIN/$YEAR/$1.git | |
#get some default folder contents | |
cp -r /usr/local/bin/git_defaults/* ./ | |
mv gitignore .gitignore | |
echo $1 >> README | |
git add . | |
git commit -m 'Created new repo' | |
git push origin master | |
echo " | |
[branch \"master\"] | |
remote = origin | |
merge = refs/heads/master" >>.git/config | |
echo "Your new git repo '$1' should be all set up at $DREAMGIT_DOMAIN/$GIT_DOMAIN/$YEAR/$1.git" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
my version: https://gist.github.com/1071044