Skip to content

Instantly share code, notes, and snippets.

@leonardofaria
Created July 8, 2011 03:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leonardofaria/1071044 to your computer and use it in GitHub Desktop.
Save leonardofaria/1071044 to your computer and use it in GitHub Desktop.
Bash script to create and initialize a git repo on a dreamhost server
# Based on:
# http://casperfabricius.com/site/2008/09/21/keeping-git-repositories-on-dreamhost-using-ssh/
# https://gist.github.com/108398
DREAMGIT_DOMAIN=user@domain.com
GIT_DOMAIN=git_server
DH_USER=home/user
# set up on the server
ssh $DREAMGIT_DOMAIN 'mkdir -p '$GIT_DOMAIN'/'$1'.git && cd '$GIT_DOMAIN'/'$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/$1.git
# get some default folder contents
echo "
.bundle
.DS_Store
db/*.sqlite3
log/*.log
tmp/**/*" > .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/$1.git"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment