Setup SVN Local Repository – Step by Step

0. FAQ First

Q: I heard that Subversion is an Apache extension? Does this mean I have to set up Apache to use Subversion?

A: The short answer: no. The long answer: if you just want to access a repository, then you only need to build a Subversion client. If you want to host a networked repository, then you need to set up either Apache2 or an “svnserve” server.

for more faq:

1. Creating The Repository With TortoiseSVN image

  1. Open the windows explorer
  2. Create a new folder and name it e.g. SVNRepository
  3. Right-click on the newly created folder and select TortoiseSVN β†’ Create Repository here….

A repository is then created inside the new folder. Don’t edit those files yourself!!!. If you get any errors make sure that the folder is empty and not write protected.



2. Local Access to the Repository

To access your local repository you need the path to that folder. Just remember that Subversion expects all repository paths in the form file:///C:/SVNRepository/. Note the use of forward slashes throughout.

To access a repository located on a network share you can either use drive mapping, or you can use the UNC path. For UNC paths, the form is file://ServerName/path/to/repos/. Note that there are only 2 leading slashes here.

3. Repository Layout

Before you import your data into the repository you should first think about how you want to organize your data. If you use one of the recommended layouts you will later have it much easier.

There are some standard, recommended ways to organize a repository. Most people create a trunk directory to hold the “main line” of development, a branches directory to contain branch copies, and a tags directory to contain tag copies. If a repository holds only one project, then often people create these top-level directories:




If a repository contains multiple projects, people often index their layout by branch:







…or by project:







Indexing by project makes sense if the projects are not closely related and each one is checked out individually. For related projects where you may want to check out all projects in one go, or where the projects are all tied together in a single distribution package, it is often better to index by branch. This way you have only one trunk to checkout, and the relationships between the sub-projects is more easily visible.

So if you haven’t already created a basic folder structure inside your repository you should do that now:

  1. create a new empty folder on your hard drive (NOT INSIDE THE Already created repository – SVNRepository)

  2. create your desired top-level folder structure inside that folder – don’t put any files in it yet!

  3. import this structure into the repository via a right click on the folder and selecting TortoiseSVN β†’ Import… This will import your temp folder into the repository root to create the basic repository layout.

Note that the name of the folder you are importing does not appear in the repository, only its contents. For example, create the following folder structure:


Import Layout C:\Temp\New into the repository root, which will then look like this:


You can also use the repository browser to create new folders directly in the repository.

4. Import Content

Before you import your project into a repository you should:

  1. Remove all files which are not needed to build the project (temporary files, files which are generated by a compiler e.g. *.obj, compiled binaries, …)

  2. Organize the files in folders and subfolders. Although it is possible to rename/move files later it is highly recommended to get your project’s structure straight before importing!

imageNow select the top-level folder of your project directory structure in the windows explorer and right click to open the context menu. Select the command TortoiseSVN β†’ Import which brings up a dialog box for you to enter the URL of the repository into which you want to import your project. 

As soon as you press OK TortoiseSVN imports the complete directory tree including all files into the repository. As before, the name of the folder you import does not appear in the repository, only the folder contents. The project is now stored in the repository under version control. Please note that the folder you imported is NOT under version control! To get a version-controlled working copy you need to do a Checkout of the version you just imported.




For more information, take a look at the TortoiseSVN Help Context Menu.


15 thoughts on “Setup SVN Local Repository – Step by Step

  1. Very nice tutorial regarding TortoiseSVN although a little bit unclear since I am totally new with SVN πŸ™‚ Thanks.

  2. Thanks. Great tutorial. Short and sweet. But I couldn’t figure one issue. How do I store different projects in the same local svn repo? I imported one project and it didn’t ask me for a project name. And when I checked it out to test it, it did check it out, but w/o asking for the project name.

  3. Very nice tutorial! Thank you very much, I was looking for a way to set up a local SVN for a long time.
    I have two suggestions: I couldn’t find that “import layout” thing, so just did it via the repo-browser, which I found very easy. Maybe you should explain how to do it that way instead. Also it might be also useful to explain that, if one is creating new content, it’s not necessary to import stuff into SVN, just to create a new trunk/project or project/trunk folder and checkout it.

  4. Well presented, but i need to clarify this (apologies, am new to version control): we are assuming that TortoiseSVN is already installed on the system (I use Vista), right?. Thanks.

  5. which files go under branch/ tags/ and trunk/ ? it will really be useful if you give some light on this. cool tutorial though. thanks! it helped me understand some ideas about TortoiseSVN

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s