Obtaining a Shared Project with EGit

To get a project with Git, you need the address of a remote repository containing the project and a read access to the repository. Here, we assume that the repository is hosted in Bitbucket.

Step 0. Locate the Address of the Remote (Upstream) Repository

If you have access to a repository in Bitbucket hosting service, you can find its address on the Bitbucket website.

  • Go to the repository page on the Bitbucket website.
  • Copy the repository address shown on the website.

Step 1. Clone the Repository

We need to copy the content of the remote repository into a local repository and its Git working directory. This step is related to the red arrow clone from in the figure in the EGit overview page.

  • Copy the repository address shown on the website.
  • Go to the Eclipse SDK.
  • Paste the repository address on the Git Repositories View. Alternatively, you can click link “Clone a Git repository”, or the icon that depicts a database and a curved arrow (see the following figure).

  • You will get a window similar to the following figure.

  • (1) The address of the remote repository should already be filled.
  • (2) Fill in the Authentication part with your Bitbucket username and password. Also click the checkbox to store your credentials in a secure store.
  • (3) Click the Next and eventually Finish buttons until your local repository and working directory is created.
  • In the Git Repositories View, you should get the newly created repository as also depicted in the figure below.

Step 2. Import the Project into the Eclipse Workspace

To work with the project, we need to import it into the Eclipse workspace. This step corresponds to the green arrow import in the figure that depicts EGit.

  • In the Git Repositories View, select the local repository containing the shared project.
  • Right click and select Import Projects…
  • Then on the popped up window, select Finish
  • Your Eclipse workspace should now contain the shared project, both in the Package Explorer View and also in the Blocks View.