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 in case you are doing a one-off import of svn repository to git. However, if you plan to repeatedly synchronize the 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:

Author: (no author) not defined in authors file

I came across the following error message

Author: (no author) not defined in authors file

when I tried to import an SVN repository (Open Yahtzee‘s) to Git using git svn and I specified an authors file (using -A). Indeed, the first commit to the svn (which was done using cvs2svn) had no username for the commiter. Apperantly the workaround is to add the following line to your author file.

(no author) = no_author <no_author@no_author>

I tried also doing the same without an email address, but it just didn’t work. It seems Git requires that all authors have an email address.