How to Port SVN to Git on Mac OS X


sudo gem install svn2git
touch authors.txt
echo "svn_name1 = Firstname Lastname <>" >> authors.txt
mkdir project
cd project
svn info
svn2git --verbose --authors ../authors.txt

This was a tricky one. First you need to find out whether the svn module for git is installed. You can do this by running git svn --help. In case it is not installed you can get it by (re-)installing git via homebrew. In case you don’t have homebrew it get gets even trickier, but I found a nice tutorial here.

The next thing you want is svn2git. You can install it via sudo gem install svn2git, which worked effortlessly since ruby and gem were pre-installed.

Now you should create a authors.txt file which maps svn usernames to git names and emails. It looks like this:

svn_name1 = Firstname Lastname <>
svn_name2 = Firstname Lastname <>

Invoke svn2git --verbose in a new folder with the URL to your svn repo. I suggest adding --verbose to get some idea about whats happening.

I my case it didn’t work. The reason were the SSL certificate and the password protection of the svn repo. The README suggests adding the username with --username but it did not work. Instead I logged into the repository via svn info There I got prompted to insert my username and password. After that I was asked to accept the certificate. I chose p to accept it permanently.

With the shadow of the login we can now invoke

svn2git --verbose --authors /path/to/authors.txt

However, I still got an error: svn2git 'master' did not match any file(s) known to git. To prevent this I added the --rootistrunk flag. Note that this only works after removing the git folder with rm -r .git/ . </></></>

© 2022 Florian Klampfer

Powered by Hydejack v9.1.6