Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » multiple git repositories in a single Eclipse project?(how to manage multiple git repos in a single Eclipse project)
multiple git repositories in a single Eclipse project? [message #1736170] Mon, 27 June 2016 09:14 Go to next message
Horacio Anton Quiles is currently offline Horacio Anton QuilesFriend
Messages: 12
Registered: June 2016
Junior Member
Hello,

I have an Eclipse (CDT) project which contains multiple git repositories. The project's root directory is a git repository itself; various subdirectories also contain their own repositories.

Eclipse easily connects to the root git repository, but I have been unable to find a way to make Eclipse realize that the subdirectories correspond to different repositories.

Is there a way to do it?

If not, why? Is it just not implemented? Or maybe it can't be done because of an EGit limitation, or a limitation in the Eclipse Team Provider infrastructure? (I'm assuming that this kind of thing should be transparent to JGit, just as it is to the native git). Should I open a bug report/feature request? (if so, where? in EGit's tracker?)

And, can anyone propose an alternative? For example, I have tried keeping each repository in its own project, and use the project's properties to exclude the subdirectories in the root project while making it depend from the "subprojects" - but it's messy, and still, the whole project gets built by a single makefile, so the non-root projects have their indexing messed up because of their lack of access to the build console output.

I have seen mentions of using git submodules to make this kind of repository nesting explicit at the git level. But submodules seem to have their own problems, which is the reason why I am not using them already outside of Eclipse; so I would prefer avoiding them.

Any hint will be welcome. Thanks!
Re: multiple git repositories in a single Eclipse project? [message #1736200 is a reply to message #1736170] Mon, 27 June 2016 13:00 Go to previous messageGo to next message
Matthias Sohn is currently offline Matthias SohnFriend
Messages: 1268
Registered: July 2009
Senior Member
Recent versions of EGit should properly detect nested repositories.

Try to upgrade to the latest release 4.4 from http://download.eclipse.org/egit/updates
or nightly build from http://download.eclipse.org/egit/updates-nightly.
Re: multiple git repositories in a single Eclipse project? [message #1736203 is a reply to message #1736200] Mon, 27 June 2016 13:26 Go to previous messageGo to next message
Horacio Anton Quiles is currently offline Horacio Anton QuilesFriend
Messages: 12
Registered: June 2016
Junior Member
Oh my. Yeah, I just updated to just-released Eclipse Neon, and I only had to use Team->Share Project for all the nested repositories to be detected automatically.

I had checked Neon's release notes, and searched EGit's bug tracker mailing lists and this forum, but found nothing! And still I missed it...

Anyway, thank you! Smile
Re: multiple git repositories in a single Eclipse project? [message #1736268 is a reply to message #1736203] Tue, 28 June 2016 07:18 Go to previous messageGo to next message
Matthias Sohn is currently offline Matthias SohnFriend
Messages: 1268
Registered: July 2009
Senior Member
This improvement was shipped with 4.3.
Find the release notes here http://projects.eclipse.org/projects/technology.egit/releases/4.3
Re: multiple git repositories in a single Eclipse project? [message #1769544 is a reply to message #1736170] Tue, 01 August 2017 12:50 Go to previous messageGo to next message
Horacio Anton Quiles is currently offline Horacio Anton QuilesFriend
Messages: 12
Registered: June 2016
Junior Member
One year later (and after some months not using Eclipse), I am back at trying to make Eclipse find the independent git repos in subfolders of a project.

I'd swear this is the same situation I had when I started this thread, which got solved by EGit 4.4 in Eclipse Neon. But now it doesn't seem to work; Team/Share project only offers to use/create a git repo in the root dir of the project.

The only explanation I can find is that I updated Eclipse Neon to .3 and maybe something broke. Eclipse Oxygen works the same.

So: does anyone know if the support for nested folders with repos got removed or some such?

(I already checked the release notes for EGit, and only an improvement is mentioned regarding nested repositories; nothing is said about removal of the feature)

[Updated on: Tue, 01 August 2017 12:52]

Report message to a moderator

Re: multiple git repositories in a single Eclipse project? [message #1769711 is a reply to message #1769544] Wed, 02 August 2017 20:22 Go to previous messageGo to next message
T M is currently offline T MFriend
Messages: 2
Registered: August 2017
Junior Member
I think I am in the same boat.

I have an existing makefile project here:

/../workspace/root/

which I imported in to a project in Eclipse. So I see a .project file in ../root/.project

I have git repos in subfolders of the project:
/../workspace/root/comp1/,git
/../workspace/root/comp2/,git
/../workspace/root/comp3/,git

so when I go to Team > Share project and select one of the repos, I get the error:

Cannot move project root to target location /../workspace/root/comp1/root, as this location overlaps with location /../workspace/root, which contains a .project file

Re: multiple git repositories in a single Eclipse project? [message #1769853 is a reply to message #1769711] Fri, 04 August 2017 08:41 Go to previous messageGo to next message
Horacio Anton Quiles is currently offline Horacio Anton QuilesFriend
Messages: 12
Registered: June 2016
Junior Member
I have found a workaround for my problem, and probably for yours.

My problem is very specific: I already had those repos-in-subdirs detected earlier, and somehow they disappeared. I suspect, but am not sure, that this happened when upgrading Eclipse (Neon.x -> Neon.3 or Neon.3->Oxygen).

And the workaround I have found is to delete the project from the Eclipse workspace (be careful not to delete it from the disk) and just re-adding it, by using the "Makefile project with existing code" wizard. And suddenly all the repos were again there.


Now, my case was probably lucky because my project's root directory *also* contains a git repository, so using Team/Share project seemingly fell into the use case in which everything works automatically: the root git project gets detected by Eclipse, *and* the repos-in-subdirs also get automatically detected.

The rub is that, as far as I can tell, you totally depend on the automatic detection, since I don't see any way to have them explicitly detected. So in my original problem, when they just stopped being shown, the only workaround was to remove and readd the project.

So, for your case: I'd suggest you create an empty git repo in your project's root directory (maybe by just accepting the suggestion by the Team/Share project wizard), and see if those repos-in-subdirs get detected.

Good luck! (and if you let me know how it goes I will try opening a bug report for EGit...)
Re: multiple git repositories in a single Eclipse project? [message #1769855 is a reply to message #1769853] Fri, 04 August 2017 08:44 Go to previous messageGo to next message
Horacio Anton Quiles is currently offline Horacio Anton QuilesFriend
Messages: 12
Registered: June 2016
Junior Member
Sorry, I forgot to add: creating the root repo with the Team/Share project wizard is NOT enough! At that point the root repo status is shown by Eclipse, but the repos-in-subdirs do NOT get detected yet. You still have to remove the project from Eclipse, and re-add it.


I guess that the summary is: IF Eclipse *uses* (vs "creates") an existing root repo, THEN the repos-in-subdirs get detected.

[Updated on: Fri, 04 August 2017 08:45]

Report message to a moderator

Re: multiple git repositories in a single Eclipse project? [message #1770130 is a reply to message #1769855] Tue, 08 August 2017 14:28 Go to previous message
T M is currently offline T MFriend
Messages: 2
Registered: August 2017
Junior Member
Thank you! That did correctly diagnose and resolve the issues. :)
Previous Topic:I'm using searchIssues method from IssueService Class in eGit. I only get up to 10 results back.
Next Topic:eclipse git does not use stored password
Goto Forum:
  


Current Time: Tue Apr 16 08:41:22 GMT 2024

Powered by FUDForum. Page generated in 0.21779 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top