How to move git repository with all branches from bitbucket to github?

前端 未结 11 1782
孤城傲影
孤城傲影 2020-12-02 03:21

What is the best way to move a git repository with all branches and full history from bitbucket to github? Is there a script or a list of commands I have to use?

11条回答
  •  旧时难觅i
    2020-12-02 03:59

    You can refer to the GitHub page "Duplicating a repository"

    It uses:

    • git clone --mirror: to clone every references (commits, tags, branches)
    • git push --mirror: to push everything

    That would give:

    git clone --mirror https://bitbucket.org/exampleuser/repository-to-mirror.git
    # Make a bare mirrored clone of the repository
    
    cd repository-to-mirror.git
    git remote set-url --push origin https://github.com/exampleuser/mirrored
    # Set the push location to your mirror
    
    git push --mirror
    

    As Noted in the comments by L S:

    • it is easier to use the Import Code feature from GitHub described by MarMass.
      See https://github.com/new/import
    • Unless... your repo includes a large file: the problem is, the import tool will fail without a clear error message. Only GitHub Support would be able to diagnose what happened.

提交回复
热议问题