04 January 2012

How To Add An Existing Git Project to Eclipse

Here's another quick set of notes for myself for posterity. I always clone and build a project on the command line before I import it into the IDE to begin hacking code. Right now I have to handle a hairy merge so I need a visual tool to make things a bit easier. For this purpose, I want to make Eclipse git aware so that I can use the visual diff in the IDE. Hopefully these notes will help out someone else, too.

For this situation I'm dealing with a Java project that uses git. First some quick items to set the stage:

  • IDE:For Java development, my IDE of choice is the SpringSource Tool Suite (STS). If you develop Spring-based Java apps and you like Eclipse, you should really be using STS.
  • SCM: The majority of projects I have worked with over the last few years use git for SCM. It is vastly superior to any other SCM tools I've used and documentation abounds for it, but it is a bit like a razor blade.
  • IDE+SCM: The standard git tool for Eclipse is EGit

To make the Eclipse project git aware, follow these steps:

  1. Go to Window->Show View->Other
  2. In the filter field, enter the word git
  3. Select Git Repositories and click OK
  4. Click on the icon whose tooltip reads 'Add an existing local Git Repository to this view'
  5. Click on the browse button and navigate to the directory that contains the project source code
  6. Click the Search button
  7. Click OK
  8. Right-click on the project in the Package Explorer
  9. Go to Team->Share Project
  10. Select Git and click Next
  11. Check the box for 'Use or create Repository in parent folder of project - this should automatically find the .git directories
  12. Click Finish and let EGit complete the integration

After following these steps, the projects should be connected to their git repository. This allows you to handle the vast majority of git commands right from inside the IDE.

For more info about EGit, check out the EGit User Guide.


  1. Thank you! It worked perfectly!

  2. I have shared a project using the steps you've provided. However, shared project does not display on the cloned repositories in eclipse. Can you help me with this? Thanks.

    1. Unfortunately, I have not used Eclipse in many years as I switched to IntelliJ, so I no longer have Eclipse installed. My suggestion is to check the EGit documentation here:


      In addition to the docs, you may want to use the Eclipse EGit discussion forum:


  3. Thanks. Worked beautifully.

  4. Hi Bruce. I'm using STS. I've added my project to Git Repositories but the project does not automatically upload into the Package Explorer. Therefore, i'm unable to right click and select 'team'. what option should I use to get my repository, which is currently located in the Git Repositories view, to show in Package Explorer?