SVN – Creating a New Repository

Creating a new repository with Subversion is simple. Just run the following command on your svn server:

svnadmin create /path/to/svn/example.com

This will create a new, blank repository with the name “example.com”. Now you will want to do one of two things, import an existing project, or setup the initial directory structure for your new repository. To import an existing project, simply run the following command:

svn import /local/path/to/existing/project http://svn.example.com/path/to/svn/example.com

Now, if you are not importing an existing project you will want to setup your initial directory structure, most likely in the following fashion.

/path/to/svn/example.com/branches

/path/to/svn/example.com/tags

/path/to/svn/example.com/trunk

All you have to do is, checkout the project, create the necessary directories, and commit them to the repository. A friend of mine created a shell script to automate creating a new svn repository, and setting up the initial directory structure and/or importing an existing project.