Over the past couple of days I decided to start using the SVN post-commit hook for deploying sites to my staging servers. Once you get it working it will save you a massive amount of time. Make changes on your local server, then, when you’re ready, commit your changes to the repository and the server will auto-update the staging site. Nice! For instructions on how to set this up on your Dreamhost server take a look here.
Unfortunately a slight over-site on my part didn’t make deployment easy. I followed the instructions to the letter (more than once!) but received the same error on commit:
1 post-commit hook failed (exit code 255) with no output.
At first I thought this was a permissions issue but that turned out not to be the case. The solution in the end was because I was saving the do_update.cgi script in Windows format in Notepad++! Doh! Windows and UNIX new lines just don’t mix!
To save a file in UNIX compatibility mode in Notepad++ click “Edit” then “EOL Conversion”. Make sure UNIX Format is greyed out (why greyed out? no idea) when you save your CGI script. Upload to the server and you’re done. Won’t be forgetting to do that again any time soon!