Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 585
Daniel Lee Avatar asked Jul 11 '12 15:07

Daniel Lee


2 Answers

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.

like image 127
Daniel Lee Avatar answered Oct 21 '22 19:10

Daniel Lee


I'm using Eclipse 4.2 Indigo, and I've been struggling with these same problems for a while now.

If you have already cloned a repository on your machine somewhere, using EGit or whatever, you can:

1) Create a new Eclipse project.

2) File -> Import -> General -> File System Choose the cloned repository location. This will import everything, including the .git folder within the repository, into your Eclipse project in your workspace. For this it doesn't matter whether there's .project files anywhere in the imported files or not.

3) Team -> Share Project -> Git The EGit plugin should detect the .git folder within your project and suggest settings accordingly. You will have a new local repository location addded to EGit's repositories which will point to the .git folder under your project's directory.

like image 41
Ilnore Avatar answered Oct 21 '22 18:10

Ilnore