How to mirror Bitbucket repository to Github

So you have a working repo at Bitbucket and want to sync it to Github? I will explain how to achieve this.

# Clone the Bitbucket repository to your local machine:
git clone --mirror ssh://git@bitbucket.org:your_name/your_repo.git
cd your_repo.git

# Sync from remote (prune is to delete the local branches that are no longer on the Bitbucket repository)
git remote update --prune

# Push latest changes to Github
git push --mirror git@github.com:your_name/your_repo.git

Share on facebook
Share on twitter
Share on linkedin
Share on whatsapp