Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to sync a Bitbucket repo to a Github repo

Deleted user February 6, 2019

What do i need to do to sync my Bitbucket repo to my Github repo so i can pull changes from one to another?

1 answer

1 accepted

1 vote
Answer accepted
Tyler T
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 7, 2019

Hi Francisco,

You can use a modified forking workflow to accomplish this but it won't be automatically synced without a more customized solution. Below is an example of how to sync them manually.

This Stack Overflow question has a good diagram and explanation: https://stackoverflow.com/a/9257901

You can have 1 repository on your local machine and set it up to have multiple remotes. What you would want to do is something like this:

# cd into the folder on your machine
# maybe the origin is set to Github, pull the latest changes

git pull origin master

# set Bitbucket as another remote named 'bitbucket'

git remote add bitbucket git@bitbucket.org:username/repo-name.git

# push the repo to the new remote 'bitbucket'

git push bitbucket master

# now the Bitbucket repo is up-to-date

 Now, anytime you make changes and push to Github (origin), you can push to the other remote (bitbucket) to keep them in sync. Again, a more advanced solution would be to use Webhooks to sync them automatically.

Deleted user February 8, 2019

Thanks, this helped my a lot!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events