Setup svn repo with an auto update hook

This is on a MediaTemple VPS running on CentOS 5 and is assuming you already have svn installed

So first thing is to go into the hooks folder for a particluar svn repository

cd /var/svn/website/hooks

You’ll see they all have .tmpl on the end – so the’yre all just templates

To make it active we need to remove the .tmpl
The one we want is post-commit.tmpl
So jut need to copy it to new file without the extension

cp post-commit.tmpl post-commit

So now we need to vi into it
You’ll see its full or instructions, etc.
You can just leave that
Go down to bottom
Comment out the last 5 lines, well last 2 and the 2 above

Now add two lines whever u want:

cd /var/www/vhosts/somedomain.com/subdomains/devdomain/httpdocs/  #path to website
svn up

Ok save and exit

Ok now need to make executable

chmod 755 post-committ

Now, the script needs to be owned by a user that has an svn account set up in the repo

To see list of users look in the passwd file ( /var/svn/website/conf/ )

chown username post-commit

Now u can test with

./post-commit

It might need the ownership of whoever made the working copy checkout on the server, the ones I have done I have always made the first checkout on the server so it’s always been my account.  It will give an error if it needs to be a different user ownership anyway.

Comments are closed.