Written by:David Aldridge
4/26/2011 4:17 PM 

To use SVN to control changes to config directories takes a little bit of work.  The following is the simplest way to do it, using my nginx configuration directory as an example:

Create Repository:
svnadmin create /var/svn/repos/nginxconfig

Edit user account:
vi /var/svn/repos/nginxconfig/conf/passwd
Create user = password line (say admin = myadminpass)

Edit authentication:
vi /var/svn/repos/nginxconfig/conf/svnserve.conf
Uncomment anon-access, auth-access and password-db lines

Perform initial commit:
svn import /usr/local/nginx/conf svn://localhost/nginxconfig -m "Initial Import" --username admin

Perform initial checkout:
mkdir ~/tempco
svn checkout svn://localhost/nginxconfig --username admin ~/tempco

Move .svn to real directory:
mv ~/tempco/.svn /usr/local/nginx/conf

To show differences:
svn diff

To commit a new revision:
svn commit -m "Revision Notes"

This allows you to have revision control against your configuration files simply and easily.  Using SVN for the /etc directory would allow you to have revision control against most of the config files.


1 comment(s) so far...

Re: How to use SVN for revision control on configuration files

If it is more complex than a single directory then you will need to move the .svn directory for each directory.

The following command run from the root of the temporary checkout directory would automate this:

find . -iname ".svn" -type d -exec mv {} /where/the/real/dir/is/{} \;

By David Aldridge on  5/18/2011 2:33 PM

Your name:
Your email:
(Optional) Email used only to show Gravatar.
Your website:
Security Code
Enter the code shown above in the box below
Add Comment  Cancel 
You must be logged in and have permission to create or edit a blog.