jimmy keen

on .NET, C# and unit testing

How to migrate from SVN to Git on Windows using Tortoise clients

November 03, 2012 | tags: version-control git svn


My setup is simple. I have external HDD hooked, where I got my local repositories (for both Git and SVN). Being local file storage, all the navigation/URIs is done with file:/// prefixing. For version control, I usually use both TortoiseGit and TortoiseSVN clients, but now, I wanted to move one of my project from SVN repository to Git repository. It all seemed simple:

Unfortunatelly, TortoiseGit had other plans and displayed such error message:

Couldn’t open a repository: Unable to open an ra_local session to URL: Unable to open repository ‘file:///F:/SVN_Repository/Project/trunk’: Expected FS format ‘2’; found format ‘4’ at …


After some quick googling, it turned out to be well-known issue with TortoiseGit, and solution was apparently simple - all you have to do is serve SVN repository to Git via svnserve service:

  1. First, you need to get and install1 svnserve.exe. I wasn’t able to find it anywhere on my box, so I figured it doesn’t come with typical TortoiseSVN installation.
  2. Turns out it (svnserve.exe) comes with Subversion. I’ve grabbed Subversion installer from SlikSVN. You can get whichever you like, just make sure it comes with svnserve.exe (as this is our main star in this show).
  3. When installing, double check that SVNServe is actually going to be installed (for example, typical install of SlikSVN I used didn’t have it, so I had to manually select it in custom install).
  4. Once installation completes, navigate to installation directory and start svnserve.exe process, pointing it to your local SVN repository:

    >cd "C:\Program Files\SlikSvn\bin"

    >svnserve.exe --daemon --root F:\SVN_Repository

  5. To verify whether svnserve hooked up to your repository correctly, open Repo-browser for project you are migrating. The URL should use old format, with file:///SVN_Repository prefix - you need to replace it with svn://localhost/:


  6. If repo browser window correctly displays your project structure, it’s all good.
  7. Now, all you need to do is use git clone which failed at the very beginning (this will take a while as Git is going to rewrite entire commits history into its own format):

git clone

At this point it is job done. However, I didn’t really like that Git was hooked to SVN (context menu has extra svn-related commands, which I didn’t plan to use) and all that weirdness, so I decided to push entire project into brand new Git repository and clone that to my working directory:

  1. Create bare repo for your project in external storage directory (F:\GIT_Repository\Project).
  2. Point your SVN-migrated, now Git project’s origin to that repository (put bare repo path into URL box of TortoiseGit -> Push -> (Destination) Manage window).
  3. Push master to your new repository (this will naturally push entire commits history).
  4. git clone project from Git repository to your local workspace.

SVN has left the building, and the only reminiscence of it is git-svn-id tag in your commits history. For the sake of completeness, rebuild your project and run unit tests :-)

  1. There was a tiny tutorial at TortoiseSVN website but it seems to be gone. Follow guide from SilkSVN website instead.