Sam Manzer
Sam Manzer

Reputation: 1220

Eclipse Egit will not import repo in workspace

I am trying to import an existing git repository as an eclipse project. The repository is stored in the location ~/src/repo_dir, and ~/src/ is my eclipse workspace directory.

If I use the sequence of menu operations:

File --> Import --> Git --> Projects from Git --> Local --> (Select my repo) 
--> "Import as General Project"

I get the error:

/Users/me/src/repo_dir overlaps the location of another project: 'repo_dir'

and I can't import the project. It seems to be because Egit does not want the original repo that is being imported to already be in the workspace. However, if I then move the repo_dir out of the workspace directory ~/src/, and then import the project via the method above, it doesn't copy the contents to the workspace directory, so now my files live somewhere else, which is undesirable. The only workaround that I have found is to move the repo out of ~/src, import it, delete the resulting project, move the repo back into ~/src, and then import it with git as an 'Existing project.' Does anyone know of a cleaner way to handle this?

Upvotes: 2

Views: 1582

Answers (2)

ShrekWang
ShrekWang

Reputation: 384

Had this problem with Eclipse Kepler.

End up with installing Eclipse Mars and import the new project in another workspace.(Luna will also work fine)

If you need to work on current projects and set up environment for the coming one...

Upvotes: 0

Zoltán Ujhelyi
Zoltán Ujhelyi

Reputation: 13858

There are two different issues here:

  1. Git handles a selected folder in your computer as a repository - and also stores some git-related metadata in it.
  2. Eclipse handles a selected folder in your computer as your workspace. It stores that Eclipse configuration files (not meant to be shared), and even worse, it expects a single-level folder hierarchy for projects.

This means, putting a Git repository inside the workspace might cause a lot of unwanted issues - so I do not recommend this way (even if by some hack it is workable). However, if you want to organize all stuff related to an Eclipse workspace, you could create a folder structure as this:

  • eclipse-stuff
    • workspace
    • git
      • git-repo1
      • git-repo2

The workspace folder is given to Eclipse as the workspace folder, while git-repo1 and git-repo2 are your Git repositories.

On the other hand, I like to put all my git repositories into a common folder, regardless of the Eclipse workspace I use them in, but if you want to organize contents, this might not be enough for you.

Upvotes: 5

Related Questions