Skip to content

Instantly share code, notes, and snippets.

@plinionaves
Created June 11, 2019 14:04
Show Gist options
  • Save plinionaves/30f1733a8656fe688549efbed6d390f9 to your computer and use it in GitHub Desktop.
Save plinionaves/30f1733a8656fe688549efbed6d390f9 to your computer and use it in GitHub Desktop.
How to Synchronize a Bitbucket repo with Github

1 - Go to Github and create a new "empty" repository, e.g: graphql-blog-api

2 - Clone the repository locally

git clone [email protected]:plinionaves/graphql-blog-api.git
cd graphql-blog-api

3 - Now add Bitbucket repo as a new remote in Github called "sync" (or "upstream")

git remote add sync [email protected]:plinionaves/graphql-blog-api.git

4 - Verify what are the remotes currently being setup for "graphql-blog-api". This following command should show "fetch" and "push" for two remotes i.e. "origin" and "sync"

git remote -v

5 - Now do a pull from the "master" branch in the "sync" remote (pulling from Bitbucket)

git pull sync master

6 - Setup a local branch called "bitbucket" to track the "sync" remote's "master" branch

git branch --track bitbucket sync/master

7 - Now push the local "master" branch to the "origin" remote in Github.

git push -u origin master

Reference: https://gist.github.com/sangeeths/9467061

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment