1
votes

Currently i'm trying to setup a post-commit hook that automatically exports the svn copy to my www-root so that my website will be updated after a commit is done. The post-commit hook looks like this:

#!/bin/sh

# Delete Old site
rm -R /var/www/html/sha
print 1
# Export Repository
svn export --force file:///var/local/svn /var/www/html/sha

# Make sure Apache Owns the website
chown -R www-data:www-data /var/www/html/sha

But i get a lot of Permission denied errors when i commit something. Basically like this:

rm: cannot remove '/var/www/html/sha/extensions/LdapAuthentication.php': Permission denied

So i know that i need to set some new permissions but i'm not sure what permissions i have do set. the /var/www/html directory has www-data:www-data as user:group.

I connect to the svn server via tunneling meaning svh+ssh://user@host/repo

Any clues?

Okay it seems to work now. I changed the owner of the /var/www/html/sha directory to www-data:walter and remove the chown command, because you need sudo for that anyways. Works like a charm now. Thanks!

1

1 Answers

2
votes

The user account which the hook script runs under needs to have the appropriate permissions on that path.

If you use Apache to serve your repository, then the account that process runs under needs the permissions. If you use svnserve, that user account needs the permissions.

It's also possible that you have another process holding a lock on a file or directory, blocking the ability to delete it.