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

Sometimes SVN (subversion) gives this error when configuring a new repo with commit email messages. The problem is to do with the REPO/hooks/post-commit script not being executable.

The script may in fact work when one runs the post-commit script manually using, e.g.,

sudo -u www-data /var/lib/svn/REPO/hooks/post-commit /var/lib/svn/REPO 2

However, given the limited environment variables (including PATH) that are defined when Apache runs the post-commit script, it becomes necessary to explicitly include #!/bin/bash at the top of the post-commit script. This solved it for me.


2 thoughts on “Warning: post-commit hook failed (exit code 255) with no output.

  1. Hi,
    I ran into this error and I spent some hours to solve it.
    The error I made was to edit the file in Windows, so the end of the lines were “\r\n” instead of just “\n”.
    To clean up the code of the script I ran this command:

    sed -i ‘s/\r//g’ /path/of/script

    Hope this can help someone.

  2. In reply to 2shy, dos2unix is available on many Linux distros.
    In reply to the OP, thanks for pointing me in the right direction. Looks like all-in-all, the error’s indicating your post-commit script failed to run. In my case, it was because I was bringing the repository to a new system and paths had changed.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s