Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Bash script to create and initialize a git repo on a dreamhost server
#Based on:
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"

This comment has been minimized.

Copy link

commented Jul 8, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.