Setting up Subversion Environment


In the basic setup, the Subversion uses the password file to store the user names and their (encrypted) passwords.

Change the Subversion section in httpd.conf to this DAV svn SVNParentPath C:/SVN Require valid-user # how to authenticate a user AuthType Basic AuthName "My Subversion repositories" AuthUserFile "c:/SVN/passwd" and restart Apache. The content of the passwd file is managed using the htpasswd.exe utility, which is located in Apache’s bin folder.

Run this command inside the bin folder:

htpasswd.exe -b -c c:\SVN\passwd tutor tutorpass

to create the passwd file (-c option) and add the user 'tutor' with password 'tutorpass' (the -b option tells, that we want to specify the password as parameter).

If you now point your browser to the repository URL ( localhost/repos/sandbox/) the login window will appear asking for credentials. Failure to give valid credentials will result in "Authorization Required" error screen. Once the correct credentials are provided the browser session will remember them until it's closed, so you have to restart browser to 'logout'. Now the repository requires all users to login, but you get either all rights or none. Therefore we will add the settings to fine-tune the authorization. Add the new lines to our httpd.conf file section so that it looks like this:

DAV svn SVNParentPath "C:/SVN" # our access control policy AuthzSVNAccessFile "c:/SVN/access" # try anonymous access first, resort to real authentication if necessary. Satisfy Any Require valid-user# how to authenticate a user AuthType Basic AuthName "My Subversion repositories" AuthUserFile "c:/SVN/passwd" The first statement points to the access file location and "Satisfy Any" enables anonymous access (if not disabled by the access file). Don't forget to restart Apache after doing the change. Then create the access file with the following content:

# Group definition [groups] trusted = tutor, john

# Default access for all repos [/] * = @trusted = rw

# Sandbox is opened for everyone [sandbox:/] * = rw

[sandbox:/serious] * = r tutor = rw

In the first section we define groups and users assigned to them. In the following sections, the access rights for individual locations are specified. The read (r) and write (w) rights are distinguished, we can also specify no right (=no access at all). The star character stands for every user (including anonymous access). When assigning the right to a group, we have to add the @ character before the group name. The rights are inherited down the folder structure, but can be overridden (e.g. we give full anonymous access to the root of sandbox, but only anonymous read to the serious folder). As with the passwd file, changes in the access file apply immediately and they don't require Apache restart.

To test the access rights you might now create some additional users using the htpasswd.exe utility (make sure to leave out the -c parameter, otherwise you will overwrite the old file) and some more repositories using 'svnadmin create repo_name'. You can also try 'svn help mkdir' to learn how to create the serious folder, or you might rather proceed with installing TortoiseSVN and then create the serious folder in a more user-friendly way.

Installing Tortise SVN
TortoiseSVN is graphical SVN client, which integrates into Windows Explorer context menus and makes working with SVN in Windows really easy. Download the MSI installer from the project page and run through the installation, keeping the default values. After the installation is finished (and after reboot on some Windows versions), the TortoiseSVN menu items will appear in the Windows Explorer context menu. If you see them, your TortoiseSVN is installed successfully.

Now you can create the serious folder through the

About the author

AgileConnection is one of the growing communities of the TechWell network.

Featuring fresh, insightful stories, is the place to go for what is happening in software development and delivery.  Join the conversation now!