As you probably know, in less than three months’ time, Bitbucket will stop supporting Mercurial repositories.

Ever since February 1st creating new Mercurial repos has been disabled, and starting from June 1st users won’t be able to use any Mercurial features and all their existing Mercurial repos will be removed. In other words, it’s migration time.

Now, I’m not sure about your specific use case, but for me Bitbucket’s main appeal was on the one hand the ability to create Mercurial repos1, and on the other hand the ability to do so privately. Since Mercurial repos won’t be supported anymore, and GitHub has been supporting private repositories for some time now, I figured if I’m gonna migrate version control systems, why stop there? Why not also migrate providers? And so I did - using the steps outlined below:

  1. Install Miniconda for Python 3.x. You can get around this by installing Python 2 manually and then dealing with the prerequisite packages yourself but honestly, I wouldn’t bother. You can just remove Miniconda afterwards (or use to try out those fancy machine learning packages you keep hearing about).
  2. git clone somewhere nice
  3. Open up a Conda prompt in the directory where you’ve cloned fast-export
  4. conda create -n fast_export_env python=2 mercurial
  5. conda activate fast_export_env
  6. Use fast-export as instructed:
mkdir repo-git # or whatever
cd repo-git
git init
git config core.ignoreCase false  # this one's added by me -r <local-repo>
git checkout HEAD
  1. Stop, smell the roses 🌹, think about how much you’ve achieved so far. If all you wanted to do was migrate from Mercurial to Git, then good job, you did it!2
  2. Create empty GitHub repo (no readme, no license, no gitignore, no nothing)
  3. git remote add origin <your-github-repo-url>
  4. git push --all origin -u
  5. Check that everything went well (but of course it did).

That’s it, enjoy GitHub! 🤓

  1. I…had quite a few Mercurial repos. Something about feeling very strongly pro-hg some years ago when git was a royal pain to work with, especially on Windows. Now I’m older, wiser, and on a Mac, so I just don’t care that much anymore about which specific DVCS has a slightly better UI. ↩︎

  2. You should probably push your repo somewhere though 😉. ↩︎