Cannot import local git into Eclipse to create a new project (throws error "Connecting Git team provider failed")
Asked Answered
M

4

17

I created a git repository on my local computer:

git init
git add TestGit.java
git commit -m "Start"

I then went into Eclipse and chose to import and create a new project from that Git repo. During the Wizard steps, it recognized the .git directory and saw it as a repo (when I check in "Preferences", it shows under repositories) but when I then click to create the new project it fails everytime with:

Connecting Git team provider failed. See log for details.
Connecting Git team provider failed. See log for details.
Error connecting project Git Test, no Git repositories found

What could be wrong?

Edit: If I import it as a general project instead of as a new Java project, then it works! Why?

Midvictorian answered 24/3, 2016 at 0:45 Comment(1)
related question/answer #45526679Hallelujah
T
14

In the Import Projects from Git dialog the Use New project wizard option seems to be broken (see Eclipse bug 324145).

To import an existing Git repository use File > Open Projects from File System... (instead of File > Import... > Git > Projects from Git). Because of the contained TestGit.java file the project is detected and configured as a Java project. The local Git repository is also detected and added automatically.

Only if it is a Gradle project (if it contains a build.gradle file), use File > Import...: Gradle > Existing Gradle Project instead (at least until this feature request is implemented).

Triangular answered 24/7, 2017 at 6:39 Comment(4)
Hard to believe the bug is still there as of today.Secession
@lonelyloner I guess most people don't understand open source and write comments on Stack Overflow instead.Triangular
@Triangular Do you mean I should fix the bug by myself, instead of posting comments on SO, because Eclipse is an open source application?Secession
@lonelyloner No, that's not what I mean.Triangular
C
6

It worked for me: after selected Use New project wizard option, pay attention to select the workspace location, it should be set at the local repository location and not at the default workspace location. I hope this help you!

Claudine answered 24/7, 2017 at 10:24 Comment(1)
This does seem to work, but the wizard is very brittle. The project name must be absolutely identical, and the path name must be absolutely identical. This wizard needs some work, and better error messages...Obligor
A
0

I encountered same error trying to clone and import. In the end I got it work using

File --> Import --> Git --> Projects from Git (with smart import)

which incidentally seems to clone the repository and then use the abovementioned

 File > Open Projects from File System...
Authors answered 19/1, 2021 at 17:37 Comment(0)
F
0

To me some of the above answers helped me. However, it wasn't perfect. Besides, my project was a Maven one on the Github. Here are my 9 steps.

  1. (from github, copy https URL to clipboard)
  2. (in STS-eclipse) File > Import
  3. Git > Projects from Git > Next
  4. Clone URI > Next
  5. (paste copied URI into URI--it's automatic actually.) > Next > Next
  6. (change "Directory:" box value if needed) > Next
  7. (choose "Import as general project") > Next enter image description here
  8. Finish
  9. (right click project node) Configure > Convert to Maven Project enter image description here
  10. Now the project should be a Maven project. enter image description here

End.

Frangos answered 23/7, 2022 at 7:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.