2

I've googled all day and there's so many Git questions, it's hard to find anything about my actual question, which is this.

I have a local Git repository set up. I can pull a previously committed project into Eclipse (via "import..."), but when I do, the project has no association with that Git repository. The Eclipse project is actually a link to the Git work area, so I'm working with the correct files, but since Eclipse is unaware of the link, I can't use any of the team features on that project.

I realize I can then team->share the project and it will copy it somewhere else, but I don't see the point there (and it will probably break the original repository as Eclipse will move the files from the old location to the new).

In CVS and SVN you "checkout" and you get a copy and the association is automatically made with the repository you got the file from. I'm not seeing how to do that with Git in Eclipse.

5
  • When you imported it, did you use the import from file system option or the import from git option? – Holloway Mar 18 '14 at 22:34
  • I did import from the git repository view. – Stu Mar 19 '14 at 13:53
  • What do you mean by "git repository view"? When you go to file -> import -> Git -> Projects from Git, it automatically links them (or it did for me). – Holloway Mar 19 '14 at 15:13
  • I didn't do it from file import, I did it from the git repository view. I expanded the repository contents right clicked and clicked import... from the menu. I'll try it out your way. thanks. – Stu Mar 20 '14 at 17:21
  • that action (file import) gets me to the same dialog box that I get when I import from the repository, same thing, but when I do it, it doesn't attach automatically for some reason. – Stu Mar 20 '14 at 17:35
7

After much putzing around, I finally figured it out. Once you import the project from the git repository into the eclipse workspace, you then team->share it back to the same repository and it will attach it. Not sure why this is a two step process but that's how I made it go. Maybe there's a simpler way, but I haven't found it yet.

0

I had this issue as well. And I'm not sure if you are going about things the same way I did. But just to compare, I imported a project from GitHub and used the "New Project Wizard" when prompted by Eclipse. This wizard asks me to select a directory for the project. And if the directory selected there is different from the directory that the Import Wizard used to import the git repo, of course, the project is not linked.

Instead of going about the team->share method, upon importing the project (with the New Project Wizard) I made sure that the New Project Wizard used the same directory as the Import Wizard (the one the repo imported uses).

If you are able to instead Import Existing Projects, for some reason it connects everything automatically without opening the New Project Wizard.

I suppose the New Project Wizard adds one unnecessary step in this particular use case (since we can assume you mean for the imported repo to be automatically connected.

Just an observation.

0

Right click > Import > Projects from Git > Existing local repository

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.