Friday, October 31, 2014

How to Import Existing GIT Project to BitBucket

Here are the steps to import your existing GIT project to BitBucket. This tutorial focuses on local GIT project. If you plan to import project from your hosting site, checkout this Atlassian article instead.

1. Login to to your BitBucket account.

2. Create a new repo.
Click Create button.
Click Create repository button to save the new repo.

3. Open your Terminal application to the project's path.
cd /path/to/my/repo

3.1. Remove any existing remote (in this case the remote name is origin). Skip this if your project has no remote yet.
git remote rm origin

4. Point your project to the new BitBucket repo.
git remote add origin https://mybitbucketusername@bitbucket.org/mybitbucketusername/myexistingproject.git

5. Push the project and all its refs.
git push -u origin --all

6. Push tags in the project.
git push -u origin --tags

Done. :)