Dmitry Churbanov

Keep it simple, Stupid!
  • Home
  • About Me

Eclipse EGit plugin

Posted by Dmitry Churbanov on July 12th, 2010 in Development – 2 Comments

egit Eclipse Helios (ver. 3.6) is out and the second top requested feature was Git support. And here it is: EGit plug-in. It is still in the “Incubation Phase“, but you already can try it.

In this tutorial I will show the basic steps of creating Java project in eclipse using EGit plug-in. Eclipse “Helios” and EGit version 0.8.4 are used in this tutorial.

Install EGit plugin

Start eclipse. Go to Help -> Install New Software…
In the “Work with” select “All Available Sites”. And then in the search box enter git. You will see the following picture:

Searching EGit plugin

Select “Eclipse EGit (Incubation)”:
Selecting EGit plugin to install

Click Next. Eclipse JGit plugin will be installed automatically as a dependency of EGit plugin:
EGit plugin installation details

Press “Next”, accept the terms of the licence agreement:
Accepting license agreement
press Finish and after some time plugins will be installed. Restart eclipse.

Import Git repository and create new project

After eclipse is restarted select File -> Import…, and you will see the new category: Git. Expand it and select “Projects from Git”. Press next.
Import projects from git

The next window will ask you about Git repository location. You can see two buttons there: Clone and Add. Add button should be used when you already have a local copy of Git repository. If you don’t have such copy, you need to press Clone button.

Selecting git repository

In this tutorial we will import remote Git repository, i.e. at this moment we do not have a local copy of this repository on our hard drive. The Git repository which we are going to import has been already created on github.

So, press Clone button and enter all location parameters. If you go to the github project properties, you can select what protocol are you going to use. I have selected https. Here is an example (if you just copy and past url from github to URI field all other fields, except password, should be filled out automatically):

Git repository parameters

If all parameters are correct, after pressing Next button you will see the branch selection window. In my case I do not have any branches, therefore I just press Next and select where the local copy of the Git repository will be stored. And here is the problem. You should save the copy of your Git repository in the same folder where you plan to create eclipse project. If you save Git repository in another folder, you will not be able to “share” your project with that repository. There is a solution which solves this problem, but we will talk about it later.

Git local path

After that select just added Git repository and press Next button:

Selecting git repository

and “Import Projects from Git” window will appear. As we are going to create new project select “Use the New Projects wizard” and press Finish.

Sharing the imported project

Now we will create new Java Project using default parameters:
Creating Java project
Project settings

and here it is:
Java project with Git repository

We can see the name of eclipse project (”eclipse_git”), name of Git repository (”eclipse_git”) and repository branch (”master”).

Tags: eclipse, egit, git

Trackback URI | Subscribe to the comments through RSS Feed

  • Nate

    i followed the instructions for installing EGit, but the Git option never appeared in my import screen.

  • Dmitry Churbanov

    What version of eclipse do you have? 3.6?
    Did you have any errors during plugin installation?
    Did you try to restart eclipse?

RSS
  • Subscribe: Entries | Comments
  • Archives

    • August 2010 (1)
    • July 2010 (2)
    • December 2009 (1)
  • Tags

    eclipse egit git mercurial

© 2012. Dmitry Churbanov. All rights reserved. Designed by Dmitry Churbanov by reusing SimpleX WordPress theme.