After testing several approaches I finally went the svn2git way. Here's a walkthrough with a number of tips.
Setting up the migration environment
If you're on Linux, you're all set to go. If you're on Windows, there are two options,
- Sticking to Windows. Absolutely not recommended for larger repositories, the migration process is much (really, much) slower than on Linux
- Using the Windows Subsystem for Linux (WSL). Highly recommended as this is the fastest and most reliable way
Installing a current Ubuntu distro is easily done by following one of the guides available on the net. Once you can start your Bash (either in native Linux or WSL), use the following commands to download and install all required dependencies,
sudo apt-get update -y
sudo apt-get install git-core git-svn ruby subversion
sudo gem install svn2git
This will install Git, SVN and the migration environment so you're all set to go.
Migrating your repo
First, you need an authors file that contains a mapping of your SVN users to their Git counterparts. You can use the output of this command for a start:
svn log --quiet | ? { $_ -notlike '-*' } | % { ($_ -split ' \| ')[1] } | Sort -Unique
This will give you something like,
Administrator
JohnDoe
JaneDoe
...
Insert this into a new text file (e.g. c:\users\public\authors.txt) and edit the contents to look like this,
Administrator = Administrator <[email protected]>
JohnDoe = John Doe <[email protected]>
JaneDoe = Jane Doe <[email protected]>
...
This maps the SVN user names (left hand side, auto generated by the "svn log" command) to the Git users (using the usual Name <email> syntax).
Once this prerequisite is done, you can go ahead with the migration. Just create a new, empty folder (e.g. c:\users\public\git-repo) and switch to it from bash,
cd /mnt/c/users/public/git-repo
Then start the actual migration by calling,
svn2git <Your SVN repo URL> --authors /mnt/c/users/public/authors.txt --verbose
This might be a good time for a coffee or two - depending on the number of commits and your network's performance this can take anything from minutes to hours. In our environment, we had approximately 2-3 commits per second migrated. Just let the process take its time. If you get an error in a Python script, experience teaches to just retry a couple of times. The svn2git seems to have hiccups from time to time, but all in all has proven to be reliable for us.
An important note here is that your SVN repo layout is expected to be "standard", i.e. using the trunk/tags/branches structure. There are a number of options if you want to fine tune the behavior, e.g. use --notags command line switch to ignore all tags (e.g. if you're not actually working with tags).
Once the process is finished, you're all set to push your brand new Git repo to your server. You might consider changing the default branch name to main (svn2git uses "master" for this). Renaming, adding a remote server and pushing your new repo there is done with these commands,
git branch -m master main
git remote add origin <Path to your empty, remote Git repo>
git push --all origin
Wrapping up
The presented process is easy to follow and allows to migrate a full SVN repository, including all branches and tags with the full history to Git.