Getting Started with Subversion
An introduction to using Subversion to manage your source code.
Creating a Repository
You can think of a repository as a database where all the information about versioned files is stored. You can either create your repositories in lots of different folders, or select one folder and create all repositories within it. The second option is better if you want the same server to handle multiple projects.
Repositories can be created using the command line, or by using TortoiseSVN. The examples below show how to create “Repository4” in our example layout.
|
Example Layout
|
Creating with the command line
Creating with TortoiseSVN
|
Setting up a Subversion Server
Subversion is based on a client/server model, where the server takes care of storing versioned files and keeping logs of what has changed.
There are two ways to run a subversion server. The first is to install it as a module on an Apache 2 server. If you already run a local web-server, this might be the best option for you.
The second method is to use “svnserve”, which comes with the main Subversion package. It’s a simple command line tool, and is useful if you’re only a single developer or if you don’t want Apache running. There are different ways to run svnserve too, but we’ll concentrate on using it as a “daemon” process. In other words, once it’s started it will run quietly in the background.
You’ll need to specify the folder which contains your repository (or repositories), and specify a run mode. You can also supply an optional port number, instead of the default one (3690).
The following command will run a server that will serve our repositories, and will listen on port 85.
svnserve --daemon --listen-port 85 --root ”c:\repositories\”
To check if it’s working, open up a web browser and navigate to 127.0.0.1:85 (or 127.0.0.1:3690 if you didn’t specify a port number). You should see something like the following in your browser:
( success ( 1 2 ( ANONYMOUS ) ( edit-pipeline svndiff1 absent-entries ) ) )
If you don’t wish to set up a local server, you can use a professional subversion hosting service, such as wush.net or CVSDude. They take care of all of the server-side stuff, so you can concentrate on more fun jobs.
Adding password protection
If you’re intending to allow other people to access your repository, you may want to add password protection to stop unwanted guests. Thankfully this is quite easy if using svnserve, and it only takes a few steps.
- Open up your repository folder, such as “Repository1”. You should see several files and folders, including a folder called “conf”
- Open the “conf” folder, open the file “svnserve.conf” in a text editor.
- Find the line “# password-db = passwd” and remove the # at the beginning. Save and close.
- Open up the “passwd” file in a text editor. This file will contain an unencrypted list of usernames and passwords. To add a new user, add the line “user = password” after [users].

2 Comments