SVN post-commit

I followed this walk through to do post-commit:

I found out my script was not in a unix format, so I changed it and it still doesn’t work, anyone have any clues how to get it to work?

We would need to see the script in question…

#!/bin/bash wget --http-user=xxxx --http-passwd=xxxx -qO -

#!/bin/sh set -f echo "Content-Type: text/plain; Charset=iso-8859-1" echo /usr/bin/svn update /home/ryannaddy/

I have exactly the same problem.
I have gone in via SSH and confirmed my files are owned by me, 755, and in unix.
Unfortunately when it runs, it just saves a file to the server rather than updating my website (containing the text ‘/usr/bin/svn update /home/username/’ where username/ are obviously my details.

For the life of me i cant get this working and it’s a real shame there are so many posts online for this, with no silver bullet.

Hey The,

I have now managed to work it out on my own and i dont exactly know the how any why but im sure there is a simple piece of logic i am missing. For now all that matters to me is that the commit hook is working as intended. I will do my best to explain the steps i took to fix it

(I don’t know your skill level. I am pretty handy with lots of things web, but my skillset ends when things like ‘terminal’ are involved. So bear with me if any of this is overly simplistic to you)

1 - I got my hands dirty and using terminal on OSX, i logged in via ssh and ran the following command on both my hooks folder, and my cgi-bin/pri folder

I did this to verify that i indeed owned the files and not dhapache.

2 - i went to my hooks folder, and ran the wget from that directory. All that happened was a file saved to the hooks directory (just named ‘q’) that contained the ‘/usr/bin/svn update /home/ryannaddy/’ command. Something wasnt right with that.

3 - i tried a manual update from the terminal using:

which returned in the following error:

So we were getting closer.

I have the option ticked for my website to add the ‘www’ always to my domain. I guess this was throwing off my script.

4 - i tried the update again , this time with the www added:

which threw up a new error: that a file already existed with the same name. Which makes sense. When i couldn’t get any of the post-commit updates to work, i manually updated the site via ftp. So of course there was no .svn folder for the update to work.
(i added trunk, because i use a tags/branches/trunk layout in my svn. Also important to note is the trailing slash means it will grab the files and folders INSIDE trunk. Leaving off the trailing slash means grab the trunk folder and move it.)

5 - I removed all the files from my live site, and then performed the manual checkout again as above - et voila. A working copy checked out to my website.

6 - this was the final step. I updated my post-commit, and my do_update.cgi to make sure they had the www added on. I then made an update on the desktop, hit commit - and refreshed the live site. And bingo. The post-commit update had worked.

So, from what i can gather:

  • the post commit can and will fail silently. I wouldn’t have seen those errors without using the terminal to access the commands via ssh.
  • if you have the ‘add www’ option ticked in your domain setup with dreamhost - make sure to add it to the do_update.cgi
  • make sure the files are unix formatted
  • make sure the site is populated via a checkout of the svn first - NOT ftp.

I hope some of that manages to help you.
If not, im sorry - i feel your pain!