Daniel Morrison


Update: Since I wrote this, I found out the git-svnimport is deprecated. The good news is that the process is now much easier!

I started importing a bunch of our Rails plugins into GitHub this morning.

I used git-svnimport because I want the entire svn history converted to git.

A couple of issues proved problematic:

  1. Our plugins were in a single svn repository and not the typical trunk and branches setup:

    <pre>rails/plugins/acts_as_audited rails/plugins/acts_as_geocodable … rails/plugins/with_action </pre>

    To get this to work, you use the root of the repository as the path and pass -T with the path you want to fetch.

    <pre>git svnimport -T plugins/acts_as_audited http://source.collectiveidea.com/public/rails</pre>

    This is totally fine with git svn. Don’t worry about it. I strongly recommend putting each plugin (or project) into its own git repository, as it will make your git life easier.
  2. Usernames in svn are stored just as our unix usernames (brandon, daniel). For git, I want to use our email addresses.

    For that, you make a file of all the authors in the format <pre>username = User's Full Name <[email protected]></pre> and pass -A path_to_author_file

    <pre>git svnimport -T plugins/acts_as_audited -A ./authors http://source.collectiveidea.com/public/rails</pre>
    <pre>git svn clone http://source.collectiveidea.com/public/rails/acts_as_audited -A ./authors</pre>

  3. Finally, to save trouble, I want to create a new git repository. Trust me, its just easier. Pass in the path you want. -C some_path

    <pre>git svnimport -C acts_as_audited -T plugins/acts_as_audited -A ./authors http://source.collectiveidea.com/public/rails</pre>

That’s it! After that, you have a git copy of your repository and can push it to GitHub, or do whatever you want.

Here’s the final command for reference (I added -v for verbose):

<pre><del>git svnimport -v -C acts_as_audited -T plugins/acts_as_audited -A ./authors http://source.collectiveidea.com/public/rails</del> <ins>git svn clone http://source.collectiveidea.com/public/rails/acts_as_audited -A ./authors </ins></pre>

<pre>git svnimport -v -C acts_as_audited -T plugins/acts_as_audited -A ./authors http://source.collectiveidea.com/public/rails</pre>
<pre>git svn clone http://source.collectiveidea.com/public/rails/acts_as_audited -A ./authors </pre>

You may get some errors like W: Ignoring error from SVN, path probably does not exist: and HTTP Path Not Found: REPORT request failed. These are fine. Ignore them.

Check out our projects on GitHub.


  1. Kevin Ballard — February 17, 2008

    You really should use git-svn, not git-svnimport. The latter has been deprecated.

  2. Daniel Morrison — February 18, 2008

    Kevin: Yep, I found out it was deprecated a couple days after posting this.

    I hadn’t updated to git 1.5.4 yet, so I guess I should rework these instructions.

  3. ggg — August 29, 2008

    Nice article