Skip to content

Instantly share code, notes, and snippets.

@ra9r
Last active June 10, 2019 03:03
Show Gist options
  • Save ra9r/983224d10d4f9375c296e400f26b8b07 to your computer and use it in GitHub Desktop.
Save ra9r/983224d10d4f9375c296e400f26b8b07 to your computer and use it in GitHub Desktop.
How to move a private #Git repository

Step 1: Create Github repository

First, create a new private repository on Github.com. It’s important to keep the repository empty, e.g. don’t check option Initialize this repository with a README when creating the repository.

Step 2: Move existing content

Next, we need to fill the Github repository with the content from our Bitbucket repository:

  1. Check out the existing repository from Bitbucket:
$ git clone https://USER@bitbucket.org/USER/PROJECT.git
  1. Add the new Github repository as upstream remote of the repository checked out from Bitbucket:
$ cd PROJECT
$ git remote add upstream https://github.com:USER/PROJECT.git
  1. Push all branches (below: just master) and tags to the Github repository:
$ git push upstream master
$ git push --tags upstream
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment