Search code examples
eclipsegitgithubcloneegit

Importing with EGit clones repository but doesn't let me import project


I just started my third repository on Github. I initialized the repository on the website with a README file and tried importing it into Eclipse with Egit. Like my other projects from Github, the import dialog worked fine and the repository was cloned. In my file explorer, I can see the folder Egit created, as well as the .git folder and the README from the repository.

However, when I get to the point where Eclipse wants me to choose a wizard for project import, everything stops working. I can't import an existing project, because none exists yet. If I try to import it as a general project, it doesn't let me go further because it claims:

/path/to/my/folder overlaps the location of another project: 'gnu_magic'

This is indeed the name of the project I'm trying to import, but as I just imported it for the first time that shouldn't be a problem.

If I use the new project wizard, it doesn't let me use the same folder name as the project, claiming that the folder is not empty (which is true, but strange when I'm using the wizard to create an entirely new project). If I give the folder another name, it creates a project but the project isn't connected to the repository - I have no way of committing my changes back to Github.

Deleting the gnu_magic folder and starting all over again brings the same results.

Is there a way to remove the metadata over that specific project from Eclipse's configuration? I don't want to lose my other projects but I would like to work with Egit on that project.

Another interesting fact: If I clone the repository manually and then try to import it into Eclipse, as a project from my file system, it doesn't let me becasue the source is in the heirarchy of the destination.

Or am I missing the point here completely? I'm just surprised that I was able to clone the other repositories without any problems. Working with them over the past few days has been quite easy.


Solution

  • The solution was a bit strange. Here's the steps to solve it:

    1. Clone repository using EGit
    2. Eclipse refuses to import project, claiming it already exists. Exit import dialog.
    3. Create new project using existing code, using cloned repository
    4. Share project with old repository

    Now the project is once again connected to the repository. Be careful with this method because if something goes wrong you might commit over your old code. This solution works with Indigo and Juno.