Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save fecoderchinh/de41a9c2d712764021748cab9158cb1c to your computer and use it in GitHub Desktop.
Save fecoderchinh/de41a9c2d712764021748cab9158cb1c to your computer and use it in GitHub Desktop.
How to move repository from Bitbucket to GitHub with all branches and commits?

The original reference

Step 1 : Create a Blank repository on Github without Readme.md

Step 2 : Moving all code and content from bitbucket

  1. Check out the existing repository from Bitbucket: git clone https://<Bitbucket_Username>@bitbucket.org/<Bitbucket_Username>/<Repo_Name>.git
  2. Now adding new GitHub Repository as upstream remote of the repository which is clone from bitbucket. cd <Repo_Name> git remote add upstream https://github.com/<Bitbucket_Username>/<Repo_Name>.git
  3. push all branches and tags to GitHub Repository using below commands git push upstream master git push --tags upstream

Step 3 : Add URL of New Github Repository as redirect URL

git remote set-url origin https://github.com/<Bitbucket_Username>/<Repo_Name>.git

Step 4: At last Clone all branches and tags to GitHub Repository

git push --mirror

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment