More and more Plone projects are being migrated over to GitHub for various reasons. Here’s a quick guide on how to import your Collective SVN project into GitHub.
GitHub can directly import SVN projects only by specifying a URL to the repository. However, for some reason this does not work for Collective SVN repositories. The import screen keeps processing but nothing happens. You are left with the manual approach of migrating a Collective SVN repository to GitHub.
Naturally, you first need an account at GitHub. Go register if you don’t already have one!
Next you need to create a git repository. Login to GitHub and go to your Dashboard. Follow the New Repository button in the right-hand portlet and fill in the required fields. Click Create Repository. Great, your git repository is now ready!
Instead of creating a new git repository in your own account, you can also consider creating one in the unofficial “Collective” GitHub account – an experiment by a few fellow Plonistas to recreate the Collective spirit on GitHub.
First commit revision
The Collective SVN repository is huge. As of this writing, it has over 240k commits. Running “git svn clone” over the whole history takes quite some time. To speed things up, write down the revision number of the first commit in your Collective SVN repository. Inspecting the oldest entry of svn log http://svn.plone.org/svn/collective/<your.project> will give you this number.
There are many tools and approaches you one can use to perform migration from svn to git. This guide uses git-svn. While it has some limitations (branches and tags won’t be migrated) it does it’s job. All you need to do is run the following 4 commands:
$ git svn --authors-file=authors.txt clone -r<first_commit_revision>:HEAD -s \ http://svn.plone.org/svn/collective/<your.project> <your.project> $ cd <your.project> $ git remote add origin email@example.com:<your_git_username>/<your.project>.git $ git push origin master
There, your project now happily lives inside a git repository on GitHub. Access it by pointing your browser to https://github.com/<your_git_username>/<your.project>.
Big thanks to Martijn Pieters of Jarn and Kai Lautaportti of HexagonIT for helping me out with my first steps using git and GitHub, you guys rock!