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/URLs 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:
- have the original svn repository for Project located at
- targeted git repository for Project should be at
- use git clone from SVN repo command to preserve commits history
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:
- First, you need to get and install svnserve.exe. I wasn't able to find it anywhere on my box, so I figured it doesn't come with typical TortoiseSVN installation.
- Following guide from the link above, 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).
- 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).
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
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_Repositoryprefix - you need to replace it with
If repo browser window correctly displays your project structure, it's all good.
- 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):
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:
- Create bare repo for your project in external storage directory (
- 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).
- Push master to your new repository (this will naturally push entire commits history).
- 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 :-)