Subversion With Apache Web Server: Tips
Want to learn how to connect the repositories you've made? Read on to learn how to use Apache Subversion to connect your repositories using simple SSH commands.
Join the DZone community and get the full member experience.
Join For FreeApache 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 ways to connect to subversion repositories is through the Apache web server.
There are plenty of resources out there for setting up subversion with the Apache web server for different operating systems.
In this article, let’s explore how to create a user, a 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 the 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 the /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 the 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 permissions 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.
Published at DZone with permission of Swathi Prasad, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
Comments