Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

git

eclipse

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.

like image 793
Liam Avatar asked Aug 10 '11 20:08

Liam


People also ask

What is Import as general project Eclipse?

You can set the folder to be your workspace so it looks like any other of your eclipse projects. After you have cloned the repository you get back to Import -view. Now you can select the repository you just cloned from the list. Click Next and select Import as General Project .

How do I clone a Gitlab project in Eclipse?

Select the "File" > "Import" option from the menu: Select the "General" > "Projects from Git" option. Select the "Clone URI" option and click next. Now paste the string you copied from Gitlab into the "URI" text field (Eclipse may paste it automatically).


2 Answers

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.

like image 149
RoboAlex Avatar answered Oct 01 '22 03:10

RoboAlex


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.

like image 30
estani Avatar answered Oct 01 '22 05:10

estani