34

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.

1
  • 2
    Is there a pom.xml (Maven) or build.gradle (Gradle) file in the project root directory? If so, you're expected to use, as appropriate, m2e, m2eclipse, "mvn eclipse:eclipse", or "gradle eclipse" to generate the Eclipse project files. It's considered good practice not to check in IDE configuration. Commented Aug 11, 2011 at 1:44

5 Answers 5

45

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.

Sign up to request clarification or add additional context in comments.

2 Comments

This is the correct and easiest way I have seen. Thanks for the help.
Best answer and very easy.
10

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.

3 Comments

I had an existing git (not eclipse) project in my workspace directory; I used just steps 2 and 3 to get Eclipse to be aware of it.
When I click Import Projects, then "Import Existing Projects" -> Next, it comes up with nothing. I am using Eclipse Juno. First, I created the projects on Eclipse (Windows), committed to the repository, and pushed (I'm using GitHub). Now, I am trying to retrieve that on Eclipse (Mac). I configured the same repository, and executed a Fetch - that gave me a progress bar and appeared to download, but Import Projects is coming up blank. Do you have any advice on what I am missing or did wrong? Thanks!
(Follow-up) Apparently I had to hit the refresh button (the 2 circular yellow arrows), now the projects show up in the Git Repositories view, and I am able to import them. Hope this helps someone else!
2

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

Comments

0

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

1 Comment

How to you make it appear in the project explorer since it cannot get imported? I still get he same error...
-1

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

1 Comment

He said it isn't an Eclipse project (no .project file) so this method won't work.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.