views:

158

answers:

2

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.

+2  A: 

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.

Peter Eisentraut
+1  A: 

This may help as it will allow the server to access itself:

Allow from 127.0.0.1
Require valid-user
Satisfy any
Dingo
Exactly what I needed. Thank you very much.
Camsoft
It turned out adding this indeed fixes the issue of the post-commit scripts not working but tortoisesvn no longer or requires that Windows users supply a username and password. So I can only guess that the web dav URL's used to specify location of repository resolve to 127.0.0.1.
Camsoft