As GitHub is now giving unlimited free private repositories to all users, you might want to move some of your private repositories to GitHub. Here's how you do it.
- Create a new repository here: https://github.com/new
- Ensure that it's PRIVATE if you don't want it sharing.
- Note: This can be the same name as your BitBucket repository.
- This will create a new repository here: https://github.com/YOUR-USERNAME/NEW-REPOSITORY-NAME
This will be where you've checked out your BitBucket project:
cd $HOME/local-repoYour BitBucket repository was probably origin so you'll want to rename it
git remote rename origin bitbucketRemember to change YOUR-USERNAME and NEW-REPOSITORY-NAME to the your own username and the name of the repository you created earlier.
If you're using SSH keys then use this:
git remote add origin git@github.com:YOUR-USERNAME/NEW-REPOSITORY-NAME.gitIf you're using HTTPS then use this:
git remote add origin https://github.com/YOUR-USERNAME/NEW-REPOSITORY-NAME.gitgit push origin masterYour local branch will still be tracking the BitBucket remote. You can see this by using the following command:
git branch -vvUpdate your branch to use the GitHub remote repository with:
git branch -u origin/masterIf you look at your remote repositories, you'll see that you have both BitBucket and GitHub:
git remote -vYou can leave this if you still want to push code to BitBucket. If you don't then delete it with the following:
git remote rm bitbucketShout if you spot any issues with the above. Thanks.