Skip to content

Instantly share code, notes, and snippets.

@hollygood
Forked from sangeeths/github-to-bitbucket
Last active January 16, 2025 01:33
Show Gist options
  • Save hollygood/4e1cf4e3c5c21c40f0de9fd9b54996d3 to your computer and use it in GitHub Desktop.
Save hollygood/4e1cf4e3c5c21c40f0de9fd9b54996d3 to your computer and use it in GitHub Desktop.
Forking a Github repo to Bitbucket
  • Go to Bitbucket and create a new repository (its better to have an empty repo)
git clone git@bitbucket.org:abc/myforkedrepo.git
cd myforkedrepo
  • Now add Github repo as a new remote in Bitbucket called "sync"
git remote add sync git@github.com: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
  • first pull from github using the "sync" remote
git pull sync
  • setup local "github" branch to track "sync" remote's "master" branch
git branch --track github sync/master
  • switch to the new branch
git checkout github
  • create new master branched out of github branch
git checkout -b master
  • push local "master" branch to "origin" remote (bitbucket)
git push -u origin master

Courtesy: http://stackoverflow.com/questions/8137997/forking-from-github-to-bitbucket

@mvcsharepointdev
Copy link

@hollygood Thanks for the steps.. but how we can upload/push the local changes to Bitbucket cloud?,, your steps will not do this final step?

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