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.


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.

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.


The method explained here is better https://stackoverflow.com/a/12795747/988941

git remote set-url origin --add https://bitbucket.org/YOU/YOUR_REPO.git

Recent version of git handle multiple URLs in the same origin ;)


you no longer have to create these mirror links. Bitbucket has come up with this concept of smart mirror which does a real time sync to your mirror server.

More read here https://confluence.atlassian.com/bitbucketserver/smart-mirroring-776640046.html

Hope this helps!

链接地址: http://www.djcxy.com/p/49778.html

上一篇: 如何将多个网址附加到单个git远程?

下一篇: 如何制作一个GitHub镜像到Bitbucket?