Warning: use at your own risk, comes with no warranty or liability of any kind.
Although the scripts in this repository are mainly targeted at migrating a Bitbucket Mercurial repo to GitHub (using git), this section describes migrating a git repository from Bitbucket to GitHub.
The GitHub access token has to have at least the following privileges: gist, repo, write:discussion.
- Create a GitHub repository with the same name (URL) of the original repository in BitBucket.
 - Copy the description of the repository.
 - Set the 
USER_MAPPING,KNOWN_REPO_MAPPING,KNOWN_ISSUES_COUNT_MAPPING, andKNOWN_CMAP_PATHSvariables inconfig.py. - Inspect Mercurial authors with 
hg log --template "{author}\n"and add entries tomigration_data/authors.map. - Run the main migration script and observe for errors:
 
./main.py \
    --github-access-token=<github's personal access token> \
    --hg-fast-export-path=<path to hg-fast-export.sh> \
    --hg-authors-map=migration_data/authors.map \
    --hg-branches-map=migration_data/branches.map \
    [space separated list of bitbucket repositories to migrate]
- Copy Wiki by hand from the original repository.
 - Change the description of the original repository (BitBucket) to the following:
- IMPORTANT: the official repository is now at https://github.com/viperproject/...
 
 - Prevent commits in the original repository by changing its settings (BitBucket):
- All users except for 'admin' should have 'read' permission only.
 
 - Adapt the corresponding Jenkins jobs accordingly.
 
Alternative manual steps:
- Clone your mercurial repos
 python3 import-forks.py --repo <path to hg repo> --bitbucket-repository <e.g. viperproject/silver> --bitbucket-username <Bitbucket username> --bitbucket-password <Bitbucket app password>- Create folder, 
git init, andgit config core.ignoreCase false - Run 
<path to hg-fast-export.sh> -r <path to hg repo> --hg-hashin the git folder - Adapt 
config.pyto have an entry for the bitbucket-repository inKNOWN_CMAP_PATHS - Run 
python3 hg-git-commit-map.py --repo <path to git folder> --bitbucket-repository <e.g. viperproject/silver> - Push the local git repository to github
 - Adapt 
config.pyto correctly capture the Bitbucket repos, their GitHub correspondance, and the number of issues - Run 
python3 migrate-discussions.py --github-access-token <GitHub access token> --bitbucket-repository <e.g. viperproject/silver> --github-repository <e.g. viperproject/silver>to migrate the issues and pull requests (again for all repositories) 
This project reuses some code from https://github.com/jeffwidman/bitbucket-issue-migration and https://github.com/fkirc/bitbucket-issues-to-github
This script migrates:
- Bitbucket's attachments to Github's gists
 - Bitbucket's issues 
#1..#nto Github's issues#1..#n- Bitbucket's issue changes and comments to Github's comments
 - Bitbucket's issue state, kind, priority and component to Github's labels
 
 - Bitbucket's pull requests 
#1..#mto Github's issues and pull requests#(n+1)..#(n+m)- Closed Bitbucket's pull request to closed Github's issues
 - Open Bitbucket's pull request to Github's pull requests
 - Bitbucket's pull request activity and comments to Github's comments
 - Bitbucket's pull request state to Github's labels
 
 
Within a comment:
- Bitbucket's user mentions to Github's user mentions
 - Bitbucket's issue and pull request links to Github's issue links
 - ...
 
pip3 install -r requirements.pip
- Clone Bitbucket repo: 
git clone --mirror URL_TO_BITBUCKET_REPO - cd into cloned repo
 - Push to GitHub: 
git push --mirror URL_TO_GITHUB_REPO - Create a mapping of git commits to themselves: 
git log --all --format='%H,%H' > cmap.txt - Adapt 
config.pyto correctly capture the Bitbucket repos, their GitHub correspondance, and the number of issues - Run 
python3 migrate-discussions.py --github-access-token <GitHub access token> --bitbucket-repository <e.g. viperproject/silver> --github-repository <e.g. viperproject/silver>to migrate the issues and pull requests (again for all repositories)