1

I have this in my file called post-commit.sh in my hooks folder:

/usr/bin/svn update /var/www --username XXXXX --password XXXXX

now if I run:

bash post-commit.sh

everything works, but if I do a commit from my pc then it doesn't work. I've added the www-data user to the group "developers" thats the folder and file owner group for the website and svn directory. Ive made the sh file executable. What am I missing? Thanks James

James
  • 373
  • 4
  • 14

2 Answers2

2

The script should be named post-commit, not post-commit.sh.

http://svnbook.red-bean.com/en/1.7/svn.ref.reposhooks.post-commit.html

crashmstr
  • 28,043
  • 9
  • 61
  • 79
  • Renaming the file worked, now when I commit from my windows with tortoise I can see the hook run but I get the following error: svn: E155004: Working copy '/var/www' locked – James Sep 19 '13 at 06:19
  • I think the user that is running everything is www-data as that is who runs apache, is my assumption correct do you think? I've only done a standard subversion/apache install. And changed permissions to /var/www to 777 as test – James Sep 19 '13 at 06:21
  • These can be tricky to debug. You can put more commands in the script file and redirect them to a file for testing purposes. If you run the script manually, does it give you the same svn error? – crashmstr Sep 19 '13 at 11:41
  • NO if I run "bash post-commit" all works fine. It's probably connected to the user that executes it all, how would I go about being sure that this is actually www-data? – James Sep 19 '13 at 13:58
  • I'm not a Linux expert, but I'm guessing there would be something that could report the current user. Add that to the script and write it to some folder with write access to everyone. – crashmstr Sep 19 '13 at 14:59
  • ok the problem was the folder of the working copy, I ran chmod 777 and now it works. It wouldn't be the best solution if the server had different users accessing it but it only has the one user I use so no worries. Thanks. – James Sep 20 '13 at 09:16
0

you're missing the environment. Who does the script run as, try running your bash script as that user, from the directory SVN server is running.

gbjbaanb
  • 51,617
  • 12
  • 104
  • 148