Using subversion post-commit hooks with Dreamhost

Subversion is a great tool for managing code. It’s even better now that Dreamhost offers it and you get 20+gb to store stuff. I’ve been ubsing subversion to version control a web app that I’m working on. What I wanted to do was to be able to commit changes to my code repository and then have the updated files automatically deployed to the test site. This is pretty easy with subversion’s hooks. Just add an executable post-commit hook with the following:

#!/bin/sh
/usr/bin/svn export –username myusername –password mypassword –force http://youdomain.com/repository /path/to/deploy

Easy enough? Kinda. If you’re trying to get this working with Dreamhost, make sure to change the deploy directory permissions to 777 since the user dhapache is actually writing to the directory. Spent quite a while looking for solutions on the web last night and after talking to Dreamhost customer service we finally found out that the directory permissions were causing the problem. Just thought I’d blog about it in hopes of helping someone else. :)