SVN windows post-commit update hook 6


The environment is Windows XP running apache2 using TortoiseSVN. This is a development server that also has a copy of the repository trunk checked out and I want that checkout updated when somebody commits to the repository.

I spent hours on Google today trying to figure out how to get a hook script working on windows for SVN.

I found only one decent resource http://blog.pengoworks.com/index.cfm/2008/2/5/SVN-postcommit-for-Windows that didn’t work.  I kept getting the error ‘post-commit hook failed (exit code 1) with output: ‘svn is not recognized as an internal or external command, operable program or batch file.

Finally, a friend helped me out by looking up their configuration, which was a similar setup, and pointed me in the right direction. In the post-commit.bat file you create, the only thing in the file should be this windows command:

“pathToYourSVN.exe” update –username yourSVNUserName –password yourSVNPassword pathToYourCodeCheckout

It’s a very different solution and very simple as well.  Hope this helps!


Leave a comment

Your email address will not be published. Required fields are marked *

6 thoughts on “SVN windows post-commit update hook

  • Caleb

    I don’t think I’ve got the file setup right. Here is what I have in the .bat file right now:

    “C:\Program Files\Subversion\bin\svn.exe” update –username admin –password adminpassword “E:\www\websitefolder\”

    What am I doing wrong?

  • Alexander

    Caleb, you need two dashes:
    –username
    –password

    I’m also having problem though (in windows environment). When I run my command directly in shell (cmd) it updates my working copy, fine. When I execute the batch file (with same command inside), it prints only:

    Skipped ‘.’

    Any idea?

  • SparK

    make sure you have the full paths, because there are rummors that the environment vars aren’t valid for script hooks
    also, use cd as much as you need in the .bat to avoid path problems.

  • Fawad Rashid

    Here is my post-commit.bat file,

    “C:\Program Files\TortoiseSVN\bin\svn.exe” update –username fawad –password 123 “C:\apache\htdocs\svntest”

    I am getting a skipped paths warning, what am i doing wrong here