Last active
May 1, 2020 12:48
-
-
Save erictompkins/624ca2109e56ef795a282ccf622910eb to your computer and use it in GitHub Desktop.
Revisions
-
erictompkins revised this gist
May 1, 2020 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ # How to migrate a Git repository from BitBucket to GitHub 1. Create the new repository in GitHub. @@ -57,5 +57,5 @@ git remote rename gh origin ## Resources - [Working with Remotes](https://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes) - [How to Move a Private Repository from Bitbucket to Github](https://medium.com/collaborne-engineering/how-to-migrate-a-private-repository-from-bitbucket-to-github-6cddedd5d73) -
erictompkins created this gist
May 1, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,61 @@ This is based on https://medium.com/collaborne-engineering/how-to-migrate-a-private-repository-from-bitbucket-to-github-6cddedd5d73 1. Create the new repository in GitHub. 2. Make sure that you've checked out the code to your computer. ``` git clone https://[email protected]/USER/PROJECT.git ``` Or, if you already have the code checked out just pull. ``` git pull ``` 3. Navigate to the folder for the repository on your computer in your terminal. ``` cd PROJECT ``` 4. Add the GitHub repository as a new remote for the project. `gh` is just a name for the remote. We'll change it later. ``` git remote add gh [email protected]:USER/PROJECT.git ``` If you want to confirm the list of remotes. ``` git remote -v ``` 5. Push the master branch to GitHub. ``` git push gh master ``` 6. Push all tags to GitHub ``` git push --tags gh ``` 7. Check the GitHub repository and make sure that it has all the data. 8. Remove the BitBucket remote on your computer. We're assuming that the remote name is `origin`. ``` git remote remove origin ``` 9. Rename the `gh` GitHub remote to `origin`. This is more of a personal preference and not necessary. But since it's common to call a remote `origin` this doesn't hurt. ``` git remote rename gh origin ``` 10. Remove the repository in BitBucket - Go to the BitBucket web interface and log in. - Open the repository. - Go to Repository Settings - At the bottom of that page click on the `Delete Repository` button. - If desired put in the URL of the GitHub repostiory into the `URL to new location` field when confirming the deletion. ## Resources [Working with Remotes](https://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes) [How to Move a Private Repository from Bitbucket to Github](https://medium.com/collaborne-engineering/how-to-migrate-a-private-repository-from-bitbucket-to-github-6cddedd5d73)