Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
111 lines (70 sloc) 3.55 KB

Moving SVN repositories to Github

There is now an easier solution to import an existing package, see

Instructions made for

You have two options, calling directly git svn clone or use svn2git

Here is an example session of moving collective.logbook to GitHub


install svn2git (

  • on OSX Mountain Lion / Macports:

    sudo port install git-core +svn
    sudo port install rb-rubygems
    sudo gem install svn2git
  • On ubuntu:

    sudo apt-get install git-core git-svn ruby rubygems
    sudo gem install svn2git
  • Generic: install svn2git as a Ruby gem:

    sudo gem install svn2git / su -c 'gem install svn2git'

Make a proper git-svn fork

You can automate this step using in this repository.

  • Set your product name to be available in shell

    export PRODUCTNAME="collective.logbook"
  • Working directory:

  • Create repository on Github in your dashboard. Choose "collective" as the owner.

  • Grab the log from your addon and note the start and env revisions here we have : start:78034 / end:246764:

    svn log -q${PRODUCTNAME} > ../LOG
  • Optional but recommended: Remap authors commiters to FullName <email>

    • Take care of remapping to github accounts fullname/email pairs if they exists:

      cat ../LOG | awk -F '|' '/^r/ {sub("^ ", "", $2); sub(" $", "", $2); print $2" = "$2" <"$2">"}' | sort -u > ../authors-transform.txt
      cat ../authors-transform.txt
      maurits = maurits <maurits>
    • Edit the authors file:

      $ED ../authors-transform.txt
      maurits = Maurits van Rees <>
  • Run svn2git Note: the following takes 30+ minutes to complete on fast internet connection, as it walks through every of 150k+ commits in Collective SVN

    • To not grab all collective revisions, we will compute the last and first revisions and give them to svn2git with:

      export REVS="$(tail -n2 ../LOG|head -n1|awk '{print $1}'|sed "s/r//"):$(head -n2 ../LOG|tail -n1|awk '{print $1}'|sed "s/r//")"
    • Verify:

      echo $REVS
    • If you have the authors file:

      svn2git --authors ../authors-transform.txt --revision $REVS -v${PRODUCTNAME}
    • If you do not have the authors file:

      svn2git --revision $REVS -v${PRODUCTNAME}

Push code to github / Backup the old one

  • After migrating, push the git-svn checkout to github:

    git remote add origin${PRODUCTNAME}.git
    git push -u --all
    git push --tags
  • Move old trunk:

    cd ..
    svn mv -m "Moved to github"${PRODUCTNAME}/trunk${PRODUCTNAME}/trunk.old
    svn mkdir -m "Moved to github"${PRODUCTNAME}/trunk
    svn co${PRODUCTNAME}/trunk/ ${PRODUCTNAME}.old
    cd ${PRODUCTNAME}.old
    echo "Repo moved to${PRODUCTNAME}" > MOVED-TO-GITHUB.txt
    svn add MOVED-TO-GITHUB.txt
    svn commit -m "Added Github moved notice"