Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make a GitHub mirror to Bitbucket?

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.

like image 239
Matrosov Oleksandr Avatar asked Feb 04 '14 12:02

Matrosov Oleksandr


People also ask

How do I mirror a GitHub repository to Bitbucket?

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.

How do I mirror a GitHub repository?

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.

Can I fork from GitHub to Bitbucket?

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!

What is Bitbucket smart mirroring?

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.


1 Answers

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

like image 182
VonC Avatar answered Oct 11 '22 23:10

VonC