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.
USER_MAPPING
, KNOWN_REPO_MAPPING
, KNOWN_ISSUES_COUNT_MAPPING
, and KNOWN_CMAP_PATHS
variables in config.py
.hg log --template "{author}\n"
and add entries to migration_data/authors.map
../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]
Alternative manual steps:
python3 import-forks.py --repo <path to hg repo> --bitbucket-repository <e.g. viperproject/silver> --bitbucket-username <Bitbucket username> --bitbucket-password <Bitbucket app password>
git init
, and git config core.ignoreCase false
<path to hg-fast-export.sh> -r <path to hg repo> --hg-hash
in the git folderconfig.py
to have an entry for the bitbucket-repository in KNOWN_CMAP_PATHS
python3 hg-git-commit-map.py --repo <path to git folder> --bitbucket-repository <e.g. viperproject/silver>
config.py
to correctly capture the Bitbucket repos, their GitHub correspondance, and the number of issuespython3 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:
#1..#n
to Github's issues #1..#n
#1..#m
to Github's issues and pull requests #(n+1)..#(n+m)
Within a comment:
pip3 install -r requirements.pip
git clone --mirror URL_TO_BITBUCKET_REPO
git push --mirror URL_TO_GITHUB_REPO
git log --all --format='%H,%H' > cmap.txt
config.py
to correctly capture the Bitbucket repos, their GitHub correspondance, and the number of issuespython3 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)