Sync up Bitbucket with Git Hub

I have a set of repositories on Github and Bibucket. I have started from scratch all these repos are at master branch only.

 

Now after 15days i am updating Github with new changes  at master. But how to sync these details in bitbucket repos. every time i am manually deleting the repos in bitbucket and importing from github. To avoid is there any sync up process between github to bitbucket whenever an update happens or do a manual sync up whenever desired.

1 answer

0 vote

Hi Surendrat

You can configure multiple push repositories:

Remotes

Suppose your git remotes are set up like this:

git remote add github git@github.com:aee/my-project.git
git remote add bb git@bitbucket.org:ae1/my-project.git

The origin remote probably points to one of these URLs.

Remote Push URLs

To set up the push URLs do this:

git remote set-url --add --push origin git@github.com:aee/my-project.git
git remote set-url --add --push origin git@bitbucket.org:ae1/my-project.git

It will change the remote.origin.pushurl config entry. Now pushes will send to both of these destinations, rather than the fetch URL.

Check it out by running:

git remote show origin

Per-branch

A branch can push and pull from separate remotes. This might be useful in rare circumstances such as maintaining a fork with customizations to the upstream repo. If your branch follows github by default:

git branch --set-upstream-to=github next_release

(That command changed branch.next_release.remote.)

Then git allows branches to have multiple branch.<name>.pushRemote entries. You must edit the .git/config file to set them.

There are a number of resources out there on this topic and here are a couple:

Pushing to Multiple Remote Repositories Using Git

Pushing to multiple git repos

Hopefully this helps!

Cheers,

Branden

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jun 12, 2018 in Bitbucket

Do you use any Atlassian products for your personal projects?

After spinning my wheels trying to get organized enough to write a book for National Novel Writing Month (NaNoWriMo) I took my affinity for Atlassian products from my work life and decided to tr...

31,475 views 26 12
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you