I have a repo that I've cloned from GitHub and want to have a mirror of this repo on BitBucket. Is there is any way how to do it? Something like having two origin in the repo as I think.
You can use Repository Mirror Plugin for Bitbucket to automatically mirror to remote repositories. To get started, you need to enable the add-on in the 'Hooks' section of the repository settings in Bitbucket: click the Mirror Hook text (or the pencil icon) in the Hooks section of the repository settings.
Navigate to the repository you just cloned. Pull in the repository's Git Large File Storage objects. Mirror-push to the new repository. Push the repository's Git Large File Storage objects to your mirror.
When creating a new repository in BitBucket, click the button Import repository at the top right. Enter the https url found when clicking Clone or download in Github for the repository you want to fork. Give your repository a name, configure your privacy settings, and there you go!
Smart Mirroring uses a local install of Bitbucket Server (that you host) to mirror your repositories hosted in Bitbucket Cloud. For example, a local team in Austin might interact with Bitbucket Cloud (the primary), whereas a remote team, say in Sydney, clones and pulls from the mirror, which is hosted close to them.
You could simply add a second remote:
git remote add bitbucket /url/to/am/empty/bitbucket/repo
and push everything to bitbucket:
git push --mirror bitbucket
You can actually pull from or push to multiple remotes from your local repo.
Update 2020:
As noted below in Rahulmohan Kolakandy's answer, if you are talking about an on-premise BitBucket server (as opposed to bitbucket.org), then you can take advantage of BitBucket Server Smart Mirroring.
As commented by V-Q-A NGUYEN:
BitBucket Server Smart Mirroring (introduced originally in 2016, and Oct. 2017 for BitBucket Server)
is only available for customers with an active Bitbucket Data Center license
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With