2

I would like to add the project files of a brand-new Eclipse project to the root-level of a git repo. I would like it to look like something like this:

./projectrepo/.git
./projectrepo/.project
./projectrepo/src
...

However, the Eclipse Egit wizard provides no obvious way to do that, and insists on creating an undesired subdirectory (screenshots below):

./projectrepo/project/.git
./projectrepo/project/.project
./projectrepo/project/src
...

How can I get Eclipse to add my files at the repository root?

I understand that the Egit manual advises against this, but I do not plan to ever have multiple projects in this repository, so the extra directory is unnecessary (and counts against filesystem path limits on Windows). The fact that it's advised against tells me it must be possible somehow (or the documentation's wrong).


System information:

Windows 7 64-bit

Eclipse Oxygen Java EE (4.7.0 Build id: 20170620-1800)

Eclipse EGit 4.8.0.201706111038-r


Screenshots of Eclipse's current undesired behavior

Configure Git Repository wizard. Most of the things I'd like to change, like Target Location, are uneditable. Path within repository can only be used to add more extra folders. Use or create repository in parent folder of project has a freetext repository path input, but only parent folders will validate and can be used. Configure Git Repository wizard screenshot

Resulting undesired Git repository structure. I would like my project files to be in this directory, not an extra "TestProject" folder: Git repository directory structure, with undesired subdirectory

Kaypro II
  • 3,210
  • 8
  • 30
  • 41
  • That little tick box “use or create repository in parent folder of project” looks promising. What does it do? – evolutionxbox Feb 21 '18 at 00:32
  • I described it next to one of my screenshots. It's seems to be used to create the git repo inside the eclipse workspace. However, I do want to follow the other EGit recommendation and keep the git repo separate from the Eclipse workspace. – Kaypro II Feb 21 '18 at 00:36

1 Answers1

0

Try instead to:

That way, you should avoid the double-folder creation.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250