‹ jan0sch.de

Mirror svn repositories with git and svn2git


If you want to mirror a svn repository via git there is a nice little gem called svn2git available that provides easy setup. Updating your repository is done via svn2git --rebase.

However what do you do if you clone your git repo onto another machine?

The svn metadata is not stored with the repository!

You have to set it up via svn2git once more.

  1. Re-create the repository with svn2git svn://my.domain/repository or whatever you need (see svn2git docs).
  2. Add the remote for your repository (git remote add origin git@github.com:USER/REPO).
  3. Fetch the changes from the repository (git fetch origin master)
  4. Push to the repository (git push -u origin master)
  5. Update repository as usual (svn2git --rebase)

Please note that the example above asumes that the svn repository has a standard layout.

If your repo is somewhat special you should consult the svn2git manual and source code for the correct options.

By the way: The first step can take quite a while. ;-)