R – Authentication error on execution of post-commit hook in SVN

svntortoisesvnversion control

I've got a SVN post-commit hook that updates a working copy when a commit is made to the repository. The post-commit hook executes the following command:

/usr/bin/svn update /path/to/working/copy

It was working fine until I enabled the Apache mod_dav Require valid-user directive. Authentication is fine when using the tortoisesvn client for windows as it asks for your user name and password and saves the details. But as this is a non-interactive process the username and password is not supplied and the update fails.

Apache runs as user and group nobody and nogroup this is also the user and group that owns the repositories and the working copies.

The nobody user does not have a password as it cannot login in. It's just used to run Apache etc. I tried adding nobody to the dav_svn.passwd file using the following command:

htpasswd dav_svn.passwd nobody

I get the following error when trying to run the post-commit script directly at the command line:

Authentication realm:

Update:

Adding the following to the dav_svn.conf:

Allow from 127.0.0.1
Satisfy any

Fixes the issue but then causes another issue in that the tortoisesvn client no longer requires authentication.

Best Answer

It looks like Apache is asking your svn update process for a password. Which is kind of annoying for a non-interactive process. ;-)

I think you might want to re-checkout your working copy using a direct file system path instead of going through Apache.