-
Create the new repository in GitHub.
-
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
- Navigate to the folder for the repository on your computer in your terminal.
cd PROJECT
- Add the GitHub repository as a new remote for the project.
ghis 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
- Push the master branch to GitHub.
git push gh master
- Push all tags to GitHub
git push --tags gh
-
Check the GitHub repository and make sure that it has all the data.
-
Remove the BitBucket remote on your computer. We're assuming that the remote name is
origin.
git remote remove origin
- Rename the
ghGitHub remote toorigin. This is more of a personal preference and not necessary. But since it's common to call a remoteoriginthis doesn't hurt.
git remote rename gh origin
- 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 Repositorybutton. - If desired put in the URL of the GitHub repostiory into the
URL to new locationfield when confirming the deletion.