Import Subversion Repositories to Git

Install the git-svn package:

sudo apt install git-svn

Create a file named authors.txt with a mapping between SVN user names and Git authors. For example:

guyru = Guy Rutenberg <guyrutenberg@gmail.com>

Do the actual import:

git svn clone --no-metadata --stdlayout --authors-file=authors.txt file:///path/to/svn/repo

The --no-metadata option will get rid of the git-svn-id: ... lines in the commit messages. It is useful if you are doing a one-off import of an SVN repository to Git. However, if you plan to repeatedly synchronize SVN to the Git repo, that option should be omitted.

The --stdlayout flag instructs Git to assume the Subversion repository has a standard layout of trunk/tags/branches.

References: