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-repo
Your BitBucket repository was probably origin
so you'll want to rename it
git remote rename origin bitbucket
Remember 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 [email protected]:YOUR-USERNAME/NEW-REPOSITORY-NAME.git
If you're using HTTPS then use this:
git remote add origin https://github.com/YOUR-USERNAME/NEW-REPOSITORY-NAME.git
git push origin master
Your local branch will still be tracking the BitBucket remote. You can see this by using the following command:
git branch -vv
Update your branch to use the GitHub remote repository with:
git branch -u origin/master
If you look at your remote repositories, you'll see that you have both BitBucket and GitHub:
git remote -v
You 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 bitbucket
Shout if you spot any issues with the above. Thanks.