How to use Eclipse with Bitbucket

To work on a project in Eclipse and push the changes to Bitbucket, you need to have EGit installed. For more info check this link:

Installing EGit

To install EGit copy and paste this URL:
into the ‘Help > Install New Software...‘ dialog.

Install New Software

Installing EGit

Setting up SSH key

Before we import a project into Eclipse, make sure that you have SSH key set up to avoid password prompts when you push code to Bitbucket. See this post for instructions on how to create the key.

Assume you’ve created the SSH key. To load the key into your Bitbucket account follow these steps:

  1. Open a browser and log into Bitbucket.
  2. Choose avatar => Manage Account from the application menu.
    Screen Shot 2013-04-20 at 1.46.44 PM
  3. Click SSH keys.
    Screen Shot 2013-04-20 at 2.11.27 PM
  4. Open a Terminal window from your local machine and run:
    $ cat ~/.ssh/

    Copy the output of that.

  5. Go back in your browser and click the Add key button.
  6. Enter a Label for your new key and paste the copied public key into the SSH Key field.
    Screen Shot 2013-04-20 at 2.26.08 PM
  7. Click the Add key button.

Clone a Git repository

  1. Open Eclipse, then Window => Show View => Other…
    Screen Shot 2013-04-20 at 2.41.32 PM
  2. Select Git Repositories under Git and click OK.
    Screen Shot 2013-04-20 at 2.48.11 PM
  3. In Git Repository explorer click Clone a Git repository.
    Screen Shot 2013-04-20 at 5.03.10 PM
  4. Fill out the URI like so: [email protected]:account_name/your_repo.git
    account_name – is your Bitbucket account.
    your_repo – is the repo you want to clone.

    Other stuff will be automatically filled out for you.
    Screen Shot 2013-04-20 at 5.13.53 PM

  5. Check master and click next.
    Screen Shot 2013-04-20 at 5.26.30 PM
  6. Leave the Destination Directory as default or change to where ever you like and click Finish.

That’s it!