Skip to content

Instantly share code, notes, and snippets.

@everttrollip
Forked from sangeeths/github-to-bitbucket
Last active June 1, 2020 14:26
Show Gist options
  • Save everttrollip/db496013baf126a6d95867ecb2262ea6 to your computer and use it in GitHub Desktop.
Save everttrollip/db496013baf126a6d95867ecb2262ea6 to your computer and use it in GitHub Desktop.
Forking a Github repo to Bitbucket and maintaining synced updates
Go to Bitbucket and create a new repository (its better to have an empty repo)
git clone [email protected]:abc/myforkedrepo.git
cd myforkedrepo
** Make sure you do not create a README **
Now add Github repo as a new remote in Bitbucket called "sync"
git remote add sync [email protected]:def/originalrepo.git
Verify what are the remotes currently being setup for "myforkedrepo". This following command should show "fetch" and "push" for two remotes i.e. "origin" and "sync"
git remote -v
Now do a pull from the "master" branch in the "sync" remote
git pull sync master
git pull sync master --allow-unrelated-histories
If you are up-to-date, you should expect the following output:
git pull sync master --allow-unrelated-histories
From github.com:def/originalrepo
* branch master -> FETCH_HEAD
Already up to date.
Setup a local branch called "github" track the "sync" remote's "master" branch
git branch --track github sync/master
Now push the local "master" branch to the "origin" remote in Bitbucket.
git push -u origin master
Courtesy:
http://stackoverflow.com/questions/8137997/forking-from-github-to-bitbucket
https://gist.github.com/sangeeths/9467061
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment