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?
Pushing all branches to default remote Now you would have to push all commits of all branches with git push --all github . To simplify that aswell you can run git push --all github -u once and now all you'll have to do is git push . This will now by default push all branches to the default remote github.
The steps to follow in order to push new Git branches to remote repos such as GitHub, GitLab or Bitbucket are as follows: Clone the remote Git repo locally. Create a new branch with the branch, switch or checkout commands. Perform a git push with the –set-upstream option to set the remote repo for the new branch.
It's very simple.
Create a new empty repository in GitHub (without a README or license, you can add them later) and the following screen will show.
In the import code option, paste your Bitbucket repository's URL and voilà!!
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 everythingThat 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:
Import Code
feature from GitHub described by MarMass.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With