Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Moving a Git repository from BitBucket to GitHub

Pre-requisites

A new, empty Git Repository has to be created on GitHub.com (do not initialize it with a Readme or alike, when asked!)

How-to migrate Git Repository to GitHub

$ cd /path/to/project
$ git remote add upstream https://github.com/[account]/[repository].git
$ git push upstream master
$ git push --tags upstream

Decomissioning

  • First, check in the target GitHub Repository that all files, commits & tags have been successfully transferred
  • Now you may disable/remove the repository on BitBucket safely
  • When using Sourcetree, edit the "Respository settings...":
    • I personally liked to remove the old Remote "origin" (from BitBucket)
    • and changed the name of the GitHub Remote from "upstream" to "origin" instead

Credits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment