Subversion with Apache Web Server: Tips

Apache Subversion is an open source version control system and distributed as free software under the Apache License. It is often abbreviated as SVN. Subversion offers many ways to connect to your repositories. One of the popular way to connect to subversion repositories is through Apache web server.

There are plenty resources out there for setting up subversion with Apache web server for different operating systems.

In this article, let’s explore how to create a user, repository and how to control user permissions for the repositories. SSH commands will be used in this article for the explanation.

Creating repository:

To create a new repository, use the following SSH command:

cd /path/to/repos && mkdir dummy-repository && svnadmin create ./dummy-repository

Here, dummy-repository is the repository name. This command will create a new directory called dummy-repository under repos folder.

Creating a new user:

In order, to create a new user enter the following SSH command:

htpasswd -s /path/to/.svn-auth-file john.doe

Once you have the above command, you will be asked to enter a password. Enter a password and you will be prompted to re-enter the password. After you have entered the password twice, the username john.doe will be added to .svn-auth-file.

Access Control:

Edit /path/to/.svn-access-control file using a text editor and add the following. The name svn-access-control may vary depending on your setup.

[dummy-repository:/]

john.doe = rw

This configuration includes read-write access to dummy-repository and sub-folders such as trunk, branch and tags. The access can be controlled at a granular level. For example, you want to give only read access to a specific branch under dummy-repository. In that case, we can add something like this:

[dummy-repository:/branches/dummy-branch]

john.doe = r

By default, nobody will have any access to SVN repositories. You may want to provide at least read permission to all the SVN users at the root of the repository. This can be done by using the asterisk (*), which means all users. Add the following configuration in your .svn-access-control file.

[/]

* = r

If you wish to explore further on the server setup and configuration, refer Subversion with Apache web server.