Improved importing to bitbucket

Earlier, I wrote about a way to import an exisiting git project into bitbucket. I’ve since discovered a much easier way to do this using git’s own commands. Instead of having to use git’s daemon mode and have bitbucket import your repository, you should setup a new bitbucket repository and push to it. Assume you have a new repository, do the following two commands at your terminal. The key is the -u switch, which sets the master branch to track the remote repository.

git remote add origin git@bitbucket.org:user/newproject.git
git push -u git@bitbucket.org:user/newproject.git master:master

This blog serves as a good way to document what I learn.