Convert Mercurial project to Git

Convert Mercurial project to Git - from bitbucket to gitlab

This post describe the steps for converting hg (mercurial) repository (on bitbucket) to git repository with all history.

  1. cd ~
  2. Clone your Mercurial repository you want to convert
  3. Clone the convert tool : git clone
  4. git init new-git-repo
  5. cd new_git_rep
  6. Run the convert tool: ~/fast-export/ -r /path/to/old/mercurial-repo
  7. git checkout HEAD
  8. In gitlab create new project which will contain the new-git-repo
  9. Add the remote which you just created step before and push:
    • git remote add origin url-to-new-repo-in-gitlab
    • git push -u origin –all
    • git push -u origin –tags