Sharing a Project with EGit

We assume you already have a project that you want to share with your team in your Eclipse workspace. Sharing a project with EGit consists of several steps explained below.

Step 1. Create an Upstream Repository

First, we create a repository on Bitbucket.

  • Go to the Bitbucket website.
  • Type “c” then “r”.
  • Provide a name for the repository. You can also use the project name.
  • Choose Git for the repository type.
  • Click button “Create repository”.
  • You will get a page similar to the following figure:

Step 2. Clone the Upstream Repository

Then, we copy the upstream repository to a local repository and 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. Don't include the git clone part.
  • 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:

  • Fill in the Authentication part with your Bitbucket username and password. Also click the checkbox to store your credentials in a secure store.
  • Click the Next and eventually Finish buttons until your local repository and Git working directory is created.
  • In the Git Repositories View, you should get the newly created repository.

Step 3. Link the Project with the Local Repository

Next, we need connect the project to be shared in the Eclipse workspace with the Git working directory that we just created. This corresponds to the blue arrow share in the figure illustrating EGit.

  • Go to the Package Explorer View.
  • Right click the project that you want to share.
  • Select Team → Share Project.
  • You will get a new window. Then, select Git and click the Next< button.
  • You will see a window like the one below. (1) Select the local repository we just created from the drop-down list, and click (2) Finish.

Note that the project is not yet stored in the local repository. It is now in the Git working directory.

  • Go to the Package Explorer View.
  • Right click the project that we just linked and select Refresh. You should see the question marks on several files and folders in the project.
  • Go to the Git Repositories View.
  • Expand the repository that is created in Step 2. Expand further the folder called Working Directory.
  • Click the icon that indicates Refresh. It contains two curved arrows.
  • You should see that the working directory contains the shared project as also depicted in the following figure:

Step 4. Commit

The next step is to save the project in the local repository. We do this by creating a new version in the local repository, or commit in Git term. This action is depicted by the green arrow commit in the figure that illustrates EGit.

Ignore Files (.gitignore)

A Reactive Blocks project contains some directories and files that are better not saved in the local repository. We can tell Git to ignore them by adding a .gitignore file in the Git working directory.

  • Find out the location of the Git working directory. It is shown next to the Git working directory (after a dash “-“). You can also hover your pointer to see it clearly. See the previous figure.
  • In the location, create a text file named .gitignore with your favorite text editor.
  • Fill with the following:
  • You need to refresh the Git Repositories View again to see that the file is in the working directory.

Now, we are ready to commit.

  • In the Project Explorer View, right click the shared project.
  • Select Team → Commit….
  • You will get a window like the following figure.
    1. Fill in a commit message (mandatory).
    2. Select all files.
    3. Click button Commit.

Step 5. Push to Upstream

The new commit in the local repository needs to be pushed to the upstream repository. This corresponds to the golden arrow push in the figure showing EGit.

  • In the Project Explorer View, right click the shared project.
  • Select Team → Push to Upstream.
  • You will get a window confirming the push.
  • Go to Bitbucket website containing the repository. Refresh the page if necessary.


Depending on the version of EGit plugin you installed, the fifth step above may be done automatically by selecting to commit (executing step four).

Step 6. Set Administrative Rights

The last step to share your project with your development team is to assign access rights to the team members or groups.

  • In the Bitbucket website, select the setting link as shown in the following figure.
  • On the left hand-side list, select Access management.
  • Grant appropriate access rights to other users or groups as needed.