Convert SVN repository to Git repository using svn2git tool

Git is becoming increasingly popular, which is why the need to migrate from legacy version control systems like CVS, SVN to Git is of great interest. In this tutorial, I will guide you all how to convert SVN repository to Git repository using the tool svn2git!

Install the svn2git tool

First, we need to install the svn2git tool.

The homepage of the svn2git tool is: https://github.com/nirvdrum/svn2git

svn2git is a tool written in the Ruby language. Therefore, we need to install Ruby first, then use Gem tool in Ruby to install the svn2git tool.

To install Ruby, you can refer to here!

After installing Ruby, you can use gem to install svn2git.

Open the command line and type the following:

Convert SVN repository to Git repository using svn2git tool

Here, we have installed the svn2git tool and be able to start converting an SVN repository to GIT repository!

Use the svn2git tool

The general syntax for using the svn2git tool is as follows:

If your SVN repository needs to have a username and password to log in, then you use the following command:

If your SVN repository does not follow the standard structure of an SVN repository (including trunk, branches, and tags), only has trunk and tags, then you use the following command:

If your SVN repository does not follow the standard structure of an SVN repository (including trunk, branches, and tags) that only has trunk then you use the following command:

If your SVN repository does not follow the standard structure of an SVN repository (including trunk, branches and tags), then you use the following command:

And there are other options as well. You can refer to here.

For example, I need to convert the SVN repository of the cssparser library with SVN URL repository:

http://svn.code.sf.net/p/cssparser/code/trunk/cssparser

to Git repository, we will use the following command:

Convert SVN repository to Git repository using svn2git tool

Result:

Convert SVN repository to Git repository using svn2git tool

Add Comment