Developing software in the Real World

Migrating to BitBucket from Subversion

I’ve recently started the process of moving all of my Subversion repositories to BitBucket. BitBucket is my preferred git hosting supplier as its pricing structure suits me much better; that is, I have lots of private repositories and GitHub is too expensive for my case!

As I needed to migrate over one hundred repositories from Subversion to BitBucket, I automated it via a simple shell script. Rather usefully, BitBucket has an API that let me create the repository using curl and then use git to do the rest.

I’ve put this script here in the hope that it may be useful to someone else. It’s certainly been useful to me!

Note that at the top there’s this section:

You need to put your information here if you want to use this script :)

The authors.txt file is a simple text file that maps Subversion user names to git names and emails. It should look something like this:

To use this script, I simply call:

and it does its thing. Note that it’s not especially fast for a repository that has lots of history. You can also do reponame 1 which will delete the repository on BitBucket first which allows you to re-run the transfer. Note that if you do this, then you will lose any commits you independently pushed to the git repository!

3 thoughts on “Migrating to BitBucket from Subversion

  1. Hi Rob,

    Great article.

    QQ – i'm looking to migrating to BitBucket from Subversion for a company that I'm freelancing for, they are opting for bitbucket cloud. I believed running this script would do trick, however when ran it doesn't seem to upload their data to the bitbucket, when I try to save the output ( > SomeFile.txt ) there is not logs or output.

    is something you can help me with? I understand that this article is old and some of the API might be out of date, but any advice/tips/guidance would be great.


    1. Simon,

      Sorry, but I believe that BitBucket have changed their API. You may want to run each part separately to see which bit fails.

Thoughts? Leave a reply

Your email address will not be published. Required fields are marked *