enure » post

How to use SVN to Publish Content to Your Website

Say you’ve started using svn to manage your website content. Now when you commit you want to push changes to your your website.

  1. ssh into your account
  2. back up your web directory: mv www www.old
  3. make a new web directory: mkdir www
  4. cd www
  5. check out your repository to your web directory. similar to wget, you need to be specify the correct syntax so that your svn files checkout nicely so that your web directory shows your index page. For instance check out the correct path from your svn repository to the current directory (the period): svn co http://svn.url.com/trunk/www/ .
  6. to prevent visitors from browsing into your .svn directories add the following to your .htaccess file:
    RedirectMatch 403 /\.svn.*$
  7. then each time you commit changes you update your local repository in your web directory. there are a couple ways to do this, one is to use one of the svn pre-commit hook to do this automatically, another is to write a script to log into your account and update it, e.g. ssh host 'cd www; svn update; exit;'. at this point it’s quite handy to have passwordless authentication set up with the relevant account.

* * *

search

Or, see a list of articles