Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Private Github Fork in Bitbucket

#Setup remotes

# setup local repo
mkdir myrepository
cd myrepository
git init

# add  bitbucket remote as "origin"
git remote add origin ssh://git@bitbucket.org/username/myrepository.git

# add github remote as "sync"
git remote add sync https://github.com/username/repository.git

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

#Setup 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 --set-upstream github sync/master

# push local "master" branch to "origin" remote (bitbucket)
git push -u origin master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.