2009 October
selene tan

Archive for October, 2009

Git on Dreamhost

by on Oct.14, 2009, under Blog

Though my website is hosted on Dreamhost, these days I mostly use them for version control hosting. So I was very happy when they set up git on their servers.

Casper Fabricius’ Keeping git repositories on Dreamhost using SSH has some instructions and a handy script for automating the process. Thing is, I tend to create the folders and files for a project before I set up the git repository. Casper’s script assumes you want to create the folder and repository at the same time.

So here’s my version of the script. If you call it without arguments, it assumes you want to make a repository for the current directory.

  1. DREAMGIT_DOMAIN=user@yourdomain.com
  2. if [ $# -lt 1 ]; then
  3. PROJECT_DIR=${PWD##*/}
  4. else
  6. mkdir $PROJECT_DIR
  7. cd $PROJECT_DIR
  8. fi
  9. ssh $DREAMGIT_DOMAIN ‘mkdir -p ~/git/’$PROJECT_DIR‘.git && cd ~/git/’$PROJECT_DIR‘.git && git –bare init’
  10. git init
  11. git remote add origin ssh://$DREAMGIT_DOMAIN/~/git/$PROJECT_DIR.git
  12. touch .gitignore
  13. git add .
  14. git commit -m ‘Created new repo’
  15. git push origin master
  16. echo "
  17. [branch \"master\"]
  18. remote = origin
  19. merge = refs/heads/master" >>.git/config
  20. echo "Your new git repo ‘$PROJECT_DIR‘ is ready and initialized at

Note: both Casper’s and my scripts still work if you call them with a directory that exists, e.g. dreamgit dir_that_exists. You’ll see mkdir spout an error, but the rest will execute.

2 Comments :, , full post

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!