SVN repository is a collection of files and directories. These files and directories are bundled together in a particular database. SVN also records the complete history of all the modifications that have ever been made to these files.
Generally, the SVN repository can be considered as a folder or directory on our computer. These repositories may contain a collection of different or similar types of files. An SVN repository typically stores all the files and directories of a single project or maybe a collection of the interrelated projects.
Create a repository using the command line
There are many ways to create a repository in SVN. We can also create a repository using the command line.
To create an SVN repository using the command-line client, follow the below steps:
Step1: Create an empty folder with the name svn (e.g., C:\svn\). However, we can create it with any name. It is used as the root of all our repositories.
Step2: Create another folder newrepo inside C:\svn\.
Step3: Open the command prompt, change directory to D:\svn\newrepo and type the below command:
Now we have created a new repository named newrepo located at C:\svn\newrepo. Consider the below output:
The newrepo repository will look like as follows:
Create a Repository using TortoiseSVN
We can also create a repository using SVN client. To create a repository using TortoiseSVN, follow the below steps:
Step1: Open the windows explorer and create a new folder and name it e.g., SVNrepo.
Step2: Right-click on the newly created folder and select option TortoiseSVN → Create Repository here. Consider the below image:
An SVN repository has been created. Now, it will ask you for the default folder structure. Consider the below image:
Select the Create Folder structure option.
A new repository is created inside SVNrepo. Don't edit the default repository files. If it shows any errors, make sure that the folder is empty and not write-protected.
TortoiseSVN will set a default folder icon when it creates a repository to identify local repositories. If we create a repository by any other option, this folder icon is not assigned.
Create a Repository using VisualSVN Server
We can also create a repository by using the VisualSVN server. To create a repository, open the VisualSVN server manager and navigate to the Repositories option. Consider the below image:
Right-click on the repositories option to explore the repository option. Here we can find many options like create, import, browse, restore, and more.
Click on the Create new repository to create a new repository. Consider the below image:
Select the type of repository that you want to create. And click Next to continue.
Now, it will ask for the repository name. Type a repository name and click Next to continue.
In this step, choose the repository layout, whether you want to create an empty or single-project repository. It is recommended to create an empty repository so you can make it as you want. Click Next to continue.
We are about to create our first repository. In this step, we will set the initial access permission for the new repository. Kindly choose your desired access permission. However, we can edit it anytime. Click Finish to complete the process.
Now we have successfully created our repository using VisualSVN.
It will display the repository type, repository name, repository URL, and access permission.