{"id":20910151,"url":"https://github.com/viperproject/bitbucket-issue-migration","last_synced_at":"2025-05-13T07:31:33.964Z","repository":{"id":40632358,"uuid":"233817078","full_name":"viperproject/bitbucket-issue-migration","owner":"viperproject","description":"Scripts for the migration from Bitbucket to GitHub.","archived":false,"fork":false,"pushed_at":"2022-02-14T08:06:00.000Z","size":2141,"stargazers_count":25,"open_issues_count":2,"forks_count":16,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-01T19:57:50.486Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/viperproject.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-01-14T10:35:03.000Z","updated_at":"2025-03-31T16:37:52.000Z","dependencies_parsed_at":"2022-09-08T21:51:19.894Z","dependency_job_id":null,"html_url":"https://github.com/viperproject/bitbucket-issue-migration","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/viperproject%2Fbitbucket-issue-migration","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/viperproject%2Fbitbucket-issue-migration/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/viperproject%2Fbitbucket-issue-migration/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/viperproject%2Fbitbucket-issue-migration/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/viperproject","download_url":"https://codeload.github.com/viperproject/bitbucket-issue-migration/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253894796,"owners_count":21980401,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-18T14:14:05.365Z","updated_at":"2025-05-13T07:31:33.407Z","avatar_url":"https://github.com/viperproject.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bitbucket To Github Migration\n\nWarning: use at your own risk, comes with no warranty or liability of any kind.\n\nAlthough the scripts in this repository are mainly targeted at migrating a Bitbucket Mercurial repo to GitHub (using git), [this section](#git-on-Bitbucket-to-git-on-GitHub-Migration) describes migrating a git repository from Bitbucket to GitHub.\n\nThe GitHub access token has to have at least the following privileges: gist, repo, write:discussion.\n\n\n## Mercurial on Bitbucket to git on GitHub Migration\n\n* Create a GitHub repository with the same name (URL) of the original repository in BitBucket.\n* Copy the description of the repository.\n* Set the `USER_MAPPING`, `KNOWN_REPO_MAPPING`, `KNOWN_ISSUES_COUNT_MAPPING`, and `KNOWN_CMAP_PATHS` variables in `config.py`.\n* Inspect Mercurial authors with `hg log --template \"{author}\\n\"` and add entries to `migration_data/authors.map`.\n* Run the main migration script and observe for errors:\n\n```\n./main.py \\\n    --github-access-token=\u003cgithub's personal access token\u003e \\\n    --hg-fast-export-path=\u003cpath to hg-fast-export.sh\u003e \\\n    --hg-authors-map=migration_data/authors.map \\\n    --hg-branches-map=migration_data/branches.map \\\n    [space separated list of bitbucket repositories to migrate]\n```\n\n* Copy Wiki by hand from the original repository.\n* Change the description of the original repository (BitBucket) to the following:\n  * IMPORTANT: the official repository is now at https://github.com/viperproject/...\n* Prevent commits in the original repository by changing its settings (BitBucket):\n  * All users except for 'admin' should have 'read' permission only.\n* Adapt the corresponding Jenkins jobs accordingly.\n\nAlternative manual steps:\n* Clone your mercurial repos\n* `python3 import-forks.py --repo \u003cpath to hg repo\u003e --bitbucket-repository \u003ce.g. viperproject/silver\u003e --bitbucket-username \u003cBitbucket username\u003e --bitbucket-password \u003cBitbucket app password\u003e`\n* Create folder, `git init`, and `git config core.ignoreCase false`\n* Run `\u003cpath to hg-fast-export.sh\u003e -r \u003cpath to hg repo\u003e --hg-hash` in the git folder\n* Adapt `config.py` to have an entry for the bitbucket-repository in `KNOWN_CMAP_PATHS`\n* Run `python3 hg-git-commit-map.py --repo \u003cpath to git folder\u003e --bitbucket-repository \u003ce.g. viperproject/silver\u003e`\n* Push the local git repository to github\n* Adapt `config.py` to correctly capture the Bitbucket repos, their GitHub correspondance, and the number of issues\n* Run `python3 migrate-discussions.py --github-access-token \u003cGitHub access token\u003e --bitbucket-repository \u003ce.g. viperproject/silver\u003e --github-repository \u003ce.g. viperproject/silver\u003e` to migrate the issues and pull requests (again for all repositories)\n\n\nThis project reuses some code from https://github.com/jeffwidman/bitbucket-issue-migration and https://github.com/fkirc/bitbucket-issues-to-github\n\n## Features\n\nThis script migrates:\n\n* Bitbucket's attachments to Github's gists\n* Bitbucket's issues `#1..#n` to Github's issues `#1..#n`\n  * Bitbucket's issue changes and comments to Github's comments\n  * Bitbucket's issue state, kind, priority and component to Github's labels\n* Bitbucket's pull requests `#1..#m` to Github's issues and pull requests `#(n+1)..#(n+m)`\n  * Closed Bitbucket's pull request to closed Github's issues\n  * Open Bitbucket's pull request to Github's pull requests\n  * Bitbucket's pull request activity and comments to Github's comments\n  * Bitbucket's pull request state to Github's labels\n\nWithin a comment:\n\n* Bitbucket's user mentions to Github's user mentions\n* Bitbucket's issue and pull request links to Github's issue links\n* ...\n\n\n## Install dependencies\n\n`pip3 install -r requirements.pip`\n\n\n## git on Bitbucket to git on GitHub Migration\n* Clone Bitbucket repo: `git clone --mirror URL_TO_BITBUCKET_REPO`\n* cd into cloned repo\n* Push to GitHub: `git push --mirror URL_TO_GITHUB_REPO`\n* Create a mapping of git commits to themselves: `git log --all --format='%H,%H' \u003e cmap.txt`\n* Adapt `config.py` to correctly capture the Bitbucket repos, their GitHub correspondance, and the number of issues\n* Run `python3 migrate-discussions.py --github-access-token \u003cGitHub access token\u003e --bitbucket-repository \u003ce.g. viperproject/silver\u003e --github-repository \u003ce.g. viperproject/silver\u003e` to migrate the issues and pull requests (again for all repositories)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fviperproject%2Fbitbucket-issue-migration","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fviperproject%2Fbitbucket-issue-migration","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fviperproject%2Fbitbucket-issue-migration/lists"}