Skip to content

Instantly share code, notes, and snippets.

@tony4d tony4d/svn2github
Created Apr 8, 2011

Embed
What would you like to do?
Migrate an svn repository to git and github
# Assume your svn repo is located at svn://example.com/myapp/trunk
# Assume your git repo will be located at git@github.com:example/myapp.git
# First you need to generate a list of all committers in your svn tree.
# Credit David Wheeler
# http://www.justatheory.com/computers/tricks/list-all-svn-committers.html
$ svn log --quiet svn://example.com/myapp/trunk | grep '^r' | awk '{print $3}' | sort -u
# Next, create a file in your home directory named svn-committers following this format
mojombo = Tom Preston-Werner <tom@github.com>
defunkt = Chris Wanstrath <chris@wanstrath.com>
# Finally, do the migration
# Credit Jon Maddox for some of this
# http://www.jonmaddox.com/2008/03/05/cleanly-migrate-your-subversion-repository-to-a-git-repository/
$ cd ~ && mkdir myapp-tmp && cd myapp-tmp
$ git svn init svn://example.com/myapp/trunk/ --no-metadata
$ git config svn.authorsfile ~/svn-committers
$ git svn fetch
$ cd ..
$ git clone myapp-tmp myapp
$ cd myapp
$ git remote set-url origin git@github.com:example/myapp.git
$ git push origin master
@mhelie

This comment has been minimized.

Copy link

mhelie commented Apr 30, 2012

If, like me, you're trying to do this from a remote server with a large repo, you'll run into timeout problems. You have to do this locally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.