akg1817
akg1817

Reputation: 31

SVN post-commit script not being executed

I have spent a couple weeks now trying to resolve this issue (without any progress).

I followed the svn redbook section "Implementing Repository Hooks" by:

However, the post-commit script still fails to be executed whenever any user commits any artifacts to the repository.

One thing that I found within the svn redbook and the post-commit.tmpl that I am a bit confused of what exactly it is inferring is: "Note that 'post-commit' must be executable by the user(s) who will invoke it (typically the user httpd runs as), and that user must have filesystem-level permission to access the repository."

Does this mean that the user which executes the post-commit script must also be a user that can access the SVN repository (through an SVN client such as tortoiseSVN or rather a local user account that can access SVN's repository files through something such as putty). I believe this may be where my problem resides, but am not exactly convinced because the user who runs the httpd is the owner of the post-commit script and the filesystem the repository resides on. Therefore, he has all the permissions he needs to the filesystem. However, I am not able to checkout directories/files from the repository remotely using tortoiseSVN on my workstation using that user account.

Any insight is greatly appreciated!

Already reviewed references:

Upvotes: 3

Views: 3827

Answers (2)

Jeyanthan I
Jeyanthan I

Reputation: 1619

I see that you have got an error. I assume Post commit fails with a Warning message stating

post-commit hook failed (exit code 1) with output: 
You need version 1.5.0 or better of the Subversion Python Bindings 

If that is the case, I think you would have not set the environmental variable within the hook script. For security reasons, the Subversion repository executes hook programs with an empty environment — i.e., no environment variables are set at all, not even $PATH (or %PATH%, under Windows). Because of this, many administrators are baffled when their hook program runs fine by hand, but doesn't work when run by Subversion.

Note : Be sure to explicitly set any necessary environment variables in your hook program and/or use absolute paths to programs.

Upvotes: 1

PashaPash
PashaPash

Reputation: 2066

If SVN server is hosted on linux, then you need to mark file as executable for that user:

chmod a+x $REPOSITORY_HOME/hooks/post-commit

If SVN server is hosted on windows, then you probably need to rename post-commit file to post-commit.bat

Upvotes: 0

Related Questions