|Go to Bitbucket and create a new repository (its better to have an empty repo)|
|git clone email@example.com:abc/myforkedrepo.git|
|Now add Github repo as a new remote in Bitbucket called "sync"|
|git remote add sync firstname.lastname@example.org: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|
|Setup a local branch called "github"track the "sync" remote's "master" branch|
|git branch --set-upstream github sync/master|
|Now push the local "master" branch to the "origin" remote in Bitbucket.|
|git push -u origin master|
Although the above is not a real forking (in the sense that it doesn't provide all the goods that forking gives, like push request) importing is a very different thing.
Well explained "how to", thank you.
Just adding a comment about new Git versions (currently I'm in v2.16.1). When I set up to track synced remote repository I got a fatal error:
$ git branch --set-upstream github sync/master fatal: the '--set-upstream' option is no longer supported. Please use '--track' or '--set-upstream-to' instead.
Then I used recommended option
$ git branch --track github sync/master Branch 'github' set up to track remote branch 'master' from 'sync'.
Well explained how-to fork a github repo in a bitbucket server (initial status).