Dan Stutzman

How to roll out to GoDaddy shared hosting with Git

Published 2011-04-05

Git can serve as a convenient way to deploy web sites. Following instructions in this blog post, I used GoDaddy's ssh access to setup Git. (Note that it's wise to compile your own binaries instead of trusting the pre-compiled binaries the author provides). Afterwards I cloned the bare git repository to a working tree under the ~/html directory. I also switched to a branch to avoid the problem of rolling out to master when the current branch is already master. Since I didn't want to expose the contents of the .git directory publicly, I also ran echo 'deny from all' > .git/.htaccess .

My rollout script now looks like this (sensitive information has been X'd out):

#!/bin/bash -x
          git push godaddy master
          ssh X@X.com "cd html/X; git merge master; ls -l"

The script takes about 6 seconds to execute; not bad.