To convert hg repository on bitbucket to git repository follow below steps.
This will convert your hg repository to git repository and it also maintains the commit history inside git repository.
- Create new repository with Repository Type selected as Git
- follow below commands with the assumption that you already have hg repository cloned on your system. If not then you first need to clone existing hg repository.
1: $ git clone git://repo.or.cz/fast-export.git
2: $ mkdir <new git repo>
3: $ cd <new git repo>
4: $ git init
5: $ ../fast-export/hg-fast-export.sh -r <path to hg local repository>
6: $ git checkout HEAD
7: $ git remote add origin https://<username>@bitbucket.org/<username>/<new git repo>.git
8: or if you are going to use ssh authentication to push
9: $ git remote add origin [email protected]:<username>/<new git repo>.git
10: $ git push origin master
This will convert your hg repository to git repository and it also maintains the commit history inside git repository.