Search code examples
svnbashpost-commitpost-commit-hook

SVN Post-Commit Hook error 255


I am trying to create a very simple post-commit hook for a repository I have set up on my server. The script is as follows:

REPOS="$1"
REV="$2"

cd /var/www/directory && svn update --username user --password pass

When I run a commit from my SVN client, I get the following error:

post-commit hook failed (exit code 255) with no output.

However, when I run my post-commit hook from cli with sudo bash post-commit, it executes perfectly. Any ideas about what I am doing wrong?


Solution

  • 255 means a file wasn't found, try using the absolute path to all files:

    REPOS="$1"
    REV="$2"
    
    cd /var/www/directory && /usr/bin/svn update --username user --password pass
    

    The PATH env variable of the environment in which the post commit hook is running probably isn't set to include wherever the SVN executable lives.