Liam
Liam

Reputation: 351

Import an existing Git project into Eclipse without a .project file

I've forked and cloned a project to the local machine from GitHub using the terminal and am trying to import it into Eclipse.

The problem is the clone from GitHub doesn't have a .project file, so when I go import -> projects from Git, I can only import as a general project. How can I import the project to Eclipse without doing git init? Most of the solutions I saw have .project already there when they cloned it from Git.

Upvotes: 34

Views: 57595

Answers (5)

estani
estani

Reputation: 26557

After a while I got it working as expected...

Basically the wizard is broken. This is what worked for me (eclipse 4.2.2):

  1. You may use the wizard to import the git repository to your workspace.
  2. After that you need to close the wizard and open the git Repositories view. (Window->Show View->Others->Git->Git repositories)
  3. Right click on the repo you've just imported and select "Import Projects..."

I've imported a general project (it was SQL code only) and this time it worked as expected (The screen doesn't allow you to change the project name nor directory, which makes sense at this point.)

Those are the same steps performed by the wizard, but apparently it doesn't get the information about the project being already deployed at the workspace, so you get the option to change those values and it complains about the project already existing there.

Upvotes: 9

RoboAlex
RoboAlex

Reputation: 5015

Create a new java project, Untick "Use default location" and browse the git project path by clicking browse button. It works for me. I have just imported a Git, netbeans project into Eclipse through this simple method.

Upvotes: 45

lory105
lory105

Reputation: 6322

Do this:

File > Import > General > Existing Projects Into Workspace

then:

  • select root directory: select the path in you pc where the project is
  • if you want to to copy the existing project in a new project into your workspace, check the field copy projects into workspace, otherwise don't check it and continue to work directly into the existing project

Upvotes: -1

lory105
lory105

Reputation: 6322

I use eclipse 3.7 ( indigo ) and I find this great solution:

1) click on: Navigate -> Show In -> Project Explorer

2) from Filesystem folder, find and select the folder where the project is contained

3) right chick on folder, and select Promote to Project

Upvotes: 0

Nayuki
Nayuki

Reputation: 18552

You should create a new project in Eclipse and specify that the project be located in the existing directory.

Choose "Create project from existing source" in the wizard:

Eclipse: New Java Project

Upvotes: 2

Related Questions