Skip to main content

Bitbucket → GitHub Migration Tools

This repository provides a set of Python-based tools and documentation to assist in migrating repositories from Bitbucket Cloud to GitHub. It covers the full process — from auditing and mirroring git history to migrating issues, pull requests, and attachments.

The goal is to provide a reliable, transparent, and repeatable migration workflow that minimizes manual steps while ensuring that all relevant metadata is preserved.


⚖️ Disclaimer

Migration Tools Created with Claude.ai

These migration tools were developed with assistance from Claude.ai, an AI language model by Anthropic. While every effort has been made to ensure the tools are reliable and safe:

  • Use at your own risk: Always perform a dry run (dry-run subcommand) before actual migration
  • Backup your data: Ensure you have backups of your Bitbucket repositories before migration
  • Review and verify: Carefully review the migration report and verify the results
  • Test thoroughly: Test the migration process in a non-production environment first

The tools follow a conservative migration strategy (e.g., closed PRs become issues rather than GitHub PRs) to minimize risks, but repository migrations involve complex metadata and edge cases that may require manual intervention.


✨ Features

  • 🆕 Unified Migration Toolkit: Single entry point with audit, migrate, dry-run, and test-auth subcommands
  • 🔍 Interactive Audit: Pre-migration analysis with automatic configuration generation and user prompting
  • 📊 Comprehensive Analysis: Repository structure, user activity, migration estimates, and gap detection
  • 🔄 Intelligent PR Migration: OPEN PRs with existing branches become GitHub PRs, others become issues (safest approach)
  • 🔗 Automatic Link Rewriting: Cross-references between issues/PRs are automatically updated to point to GitHub
  • 📎 Advanced Attachment Handling: Downloads all attachments and inline images with informative comments for manual upload
  • 👥 Smart User Mapping: Maps Bitbucket users to GitHub accounts with support for unmapped users and account ID resolution
  • 🧪 Dry-run Capability: Simulate entire migration without making changes to validate configuration
  • 📋 Comprehensive Reporting: Detailed markdown reports with migration statistics and troubleshooting notes
  • 🔢 Placeholder Issue Creation: Preserves original numbering with placeholders for deleted/missing content
  • 📄 Configuration Management: Generate and validate migration configurations automatically
  • 🛡️ Secure Token Handling: Environment variable support and token format validation
  • 📚 Step-by-step Documentation: Checklists and guides for every phase of the migration process

Architecture Benefits

  • Modular Design: Shared components eliminate code duplication between audit and migration
  • Single Source of Truth: Consistent API interactions, user mapping, and error handling
  • Easy Maintenance: Updates to core functionality benefit both audit and migration tools
  • Backward Compatibility: Legacy scripts still supported alongside new unified toolkit

📘 Documentation

Comprehensive documentation is available at:

👉 Bitbucket → GitHub Migration Guide

It includes:

  • Quick start instructions
  • Migration and verification guides
  • Troubleshooting steps
  • Configuration references
  • Pre-/post-migration checklists

🧰 Requirements

  • Python 3.12+
  • Git 2.x+
  • Bitbucket API token
  • GitHub Personal Access Token (with repo scope)

🚀 Quick Start

# 1. Install the package globally (recommended)
pipx install bitbucket-migration

# 2. Audit Bitbucket repo (generates configuration)
migrate_bitbucket_to_github audit --workspace WORKSPACE --repo REPO --email EMAIL

# 3. Edit configuration
vim migration_config.json

# 4. Run dry-run to validate
migrate_bitbucket_to_github dry-run --config migration_config.json

# 5. Run full migration
migrate_bitbucket_to_github migrate --config migration_config.json

# 6. Follow documentation for attachment upload and verification

Alternative: Clone from source

git clone https://github.com/fkloosterman/bitbucket-migration.git
cd bitbucket-migration

# Use unified toolkit
migrate_bitbucket_to_github audit --workspace WORKSPACE --repo REPO --email EMAIL

# Or use the short alias (after installing package)
pip install -e .
bb2gh audit --workspace WORKSPACE --repo REPO --email EMAIL

For full instructions, visit the Migration Guide.

Available Commands

# Show all available commands
migrate_bitbucket_to_github --help
# Or using the short alias
bb2gh --help

# Audit repository (interactive prompts for missing args)
migrate_bitbucket_to_github audit --workspace WORKSPACE --repo REPO --email EMAIL
# Or using the short alias
bb2gh audit --workspace WORKSPACE --repo REPO --email EMAIL

# Generate configuration from audit
migrate_bitbucket_to_github audit --workspace WORKSPACE --repo REPO --email EMAIL
# Or using the short alias
bb2gh audit --workspace WORKSPACE --repo REPO --email EMAIL

# Test authentication (Bitbucket and GitHub APIs)
migrate_bitbucket_to_github test-auth --workspace WORKSPACE --repo REPO --email EMAIL --gh-owner GH_OWNER --gh-repo GH_REPO

# Dry run migration (validate configuration)
migrate_bitbucket_to_github dry-run --config migration_config.json
# Or using the short alias
bb2gh dry-run --config migration_config.json

# Full migration
migrate_bitbucket_to_github migrate --config migration_config.json
# Or using the short alias
bb2gh migrate --config migration_config.json

# Migrate only issues
migrate_bitbucket_to_github migrate --config migration_config.json --skip-prs

# Migrate only pull requests
migrate_bitbucket_to_github migrate --config migration_config.json --skip-issues

🧩 Contributing

Contributions are welcome! See the issues page for open tasks or suggestions.


📄 License

This project is licensed under the MIT License — see the LICENSE file for details.


© 2025 Fabian Kloosterman. All rights reserved.

Metadata

Release files for bitbucket-migration 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bitbucket-migration 1.0.0
File Size Uploaded Provenance Actions
bitbucket_migration-1.0.0.tar.gz 120.4 kB Without provenance Details for bitbucket_migration-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for bitbucket-migration 1.0.0
File Interpreter ABI Platform Actions
bitbucket_migration-1.0.0-py3-none-any.whl Python 3 none any Details for bitbucket_migration-1.0.0-py3-none-any.whl

Total release size: 268.6 kB

Release files / bitbucket_migration-1.0.0.tar.gz

Download URL bitbucket_migration-1.0.0.tar.gz
Size 120.4 kB
Tags Source
SHA-256 checksum
How to use checksums
079d6f22f0dbb56e63c7a7d303448c4dcd6b3e88d931b3ac2512674a6ba8c22d
BLAKE2b-256 checksum
How to use checksums
159f20f2547db550ba97986f2428bb016c1e8704fd9a2a5f96d8d8b227d793a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.9.8

Release files / bitbucket_migration-1.0.0-py3-none-any.whl

Download URL bitbucket_migration-1.0.0-py3-none-any.whl
Size 148.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d5bb116e1e3eb03de49707acb57944fd2b0135cc28541338b5474d0afc239688
BLAKE2b-256 checksum
How to use checksums
5e2c53c8ab3831057076411b654c0f458a7e4c2309421fb99f719a663bb7791f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.9.8

Security for bitbucket-migration 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page