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:
- 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).
git clone https://github.com/frej/fast-export.gitsomewhere nice
- Open up a Conda prompt in the directory where you’ve cloned
conda create -n fast_export_env python=2 mercurial
conda activate fast_export_env
mkdir repo-git # or whatever cd repo-git git init git config core.ignoreCase false # this one's added by me hg-fast-export.sh -r <local-repo> git checkout HEAD
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
Create empty GitHub repo (no readme, no license, no gitignore, no nothing)
git remote add origin <your-github-repo-url>
git push --all origin -u
Check that everything went well (but of course it did).
That’s it, enjoy GitHub! 🤓
- 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. [return]
- You should probably push your repo somewhere though 😉. [return]