Let’s move repository from Bitbucket to GitHub with all branches and commits!
I am using Bitbucket for a long time as it provides unlimited private repositories but as now GitHub also provides this I started to move my repositories to GitHub as it provides very useful tools.
Steps to move from Bitbucket to GitHub

Step 1: Create GitHub repository
First, create a new private repository on Github.com. It’s important to keep the repository empty, e.g. don’t check option Initialize this repository with a README when creating the repository.
Step 2: Move all your code and content
Next, we need to fill the Github repository with the content from our Bitbucket repository:
- Check out the existing repository from Bitbucket:
$ git clone https://USER@bitbucket.org/USER/PROJECT.git
2. Add the new GitHub repository as upstream remote of the repository checked out from Bitbucket:
$ cd PROJECT
$ git remote add upstream https://github.com:USER/PROJECT.git
3. Push all branches (below: just master) and tags to the GitHub repository:
$ git push upstream master
$ git push --tags upstream
Step 3: Add the URL of the new GitHub repository as redirect URL
$ git remote set-url origin https://github.com:USER/PROJECT.git
Step 4: Clone all branches and tags to your GitHub repository
$ git push --mirror
Step 5: Clean up old repository
Now If all contents move to GitHub double check it and after that delete Bitbucket repository if not required.
- Go to the web interface of the old Bitbucket repository
- Select menu option Setting > Delete repository
Voila your repository setup with GitHub!
If you like SMASH the CLAP 👏 Button and DISAPPEAR it from Medium.