Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save melchoy/a40b97a535df9ab9769de670aec3f3e7 to your computer and use it in GitHub Desktop.
Save melchoy/a40b97a535df9ab9769de670aec3f3e7 to your computer and use it in GitHub Desktop.
Sync github repo to bitbucket repo

Set up remotes

setup local repo

mkdir myrepository
cd myrepository
git init

add bitbucket remote as "origin"

git remote add origin ssh://[email protected]/aleemb/myrepository.git

add github remote as "sync"

git remote add sync https://github.com/aleemb/laravel.git

verify remotes

git remote -v
**should show fetch/push for "origin" and "sync" remotes**

Set up Branches

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

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

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