What's the proper method to transfer a complete Git repo from Bitbucket to GitHub?

I need to migrate my entire Git repository from Bitbucket over to GitHub. I want to make sure I don’t lose anything important in the process.

The repository has multiple branches that I’ve been working on, and I really need to preserve all the commit history. I don’t want to start fresh because there’s valuable development history that my team references.

I’m looking for a step-by-step approach or maybe some command line instructions that will help me do this migration properly. Has anyone done this before? What’s the most reliable way to ensure everything transfers correctly including all the branches and commit logs?

just migrated last month and got hit by something no one talks about - .gitignore files can get corrupted during the transfer. caused me headaches later. also, install git-lfs before you start if you’ve got large files tracked with it. half my assets disappeared because i forgot this step.

hey, i just did this the other day! use git clone --mirror old-repo-url, then change the remote with git remote set-url origin new-github-url, and finally use git push --mirror. that’s it, super easy!

GitHub’s built-in importer works great if you don’t want to mess with command line. Just hit the plus icon, select “Import repository”, and paste your Bitbucket URL and credentials. It keeps all your commit history, branches, and tags automatically. I used this when we moved from our old Bitbucket setup - handled everything perfectly, even the messy merge commits that broke my manual attempts. Takes longer for big repos but runs in the background so you can keep working. Plus it validates everything and shows exactly what got imported. Don’t delete your Bitbucket repo until you’ve checked everything transferred right, especially if you’ve got weird branch names or special characters in commits.

I moved several repos last year and learned to create the GitHub repo through their web interface first - saves headaches later. After you clone your Bitbucket repo locally with git clone --bare, run git branch -a to make sure all branches came over before pushing to the new remote. What caught me off guard: repository visibility settings don’t carry over, so double-check those on GitHub. Branch protection rules and webhooks also need manual recreation since they don’t transfer with the Git data. Bare clone keeps everything - tags, branch references, the works. Just remember your team needs to update their local environments to point to the new GitHub remote.

The mirror approach works but manual Git commands are tedious and error-prone. I’ve migrated dozens of repos and now I automate everything.

Build a workflow that clones your Bitbucket repo, creates the GitHub repo, and pushes everything over. You can schedule it to run multiple times during migration to catch new commits.

I built something that monitors our repos and syncs them across platforms. Takes 5 minutes to set up instead of doing the clone, remote, push dance repeatedly.

You can reuse the same automation for future migrations. Plus you get logs showing exactly what transferred so nothing gets missed.

Check out Latenode for building these workflows. Way cleaner than wrestling with Git commands: https://latenode.com