Convert a Private Project on bitbucket.com to a github Public Project

  1. Create a public repo on github, you can add README or License files on the master branch, suppose the url is:

    https://github.com/leetschau/don4.git

  2. Get the private repo:

    $ git clone https://leechau@bitbucket.org/leechau/donno.git $ cd donno $ git branch -v -a (list all remote branches for checkout) $ git checkout -b develop origin/develop (copy remote branch to local repo and update working directory)

  3. Publish to github, you have 2 choices:

    i. Publish selected branches:

    $ git remote add don4 https://github.com/leetschau/don4.git
    $ git push -u don4 master
    $ git push -u don4 develop
    

    or you can push your "master" branch to remote as "init" branch for avoid confliction with master branch created on github:

    $ git push don4 master:init
    

    i. Publish all branches:

    $ git push --mirror https://github.com/leetschau/don4.git
    

    In this case you can't create README or License files when creating github project, to avoid conflict on master branch.

原文地址:https://www.cnblogs.com/darkmatter/p/3605589.html