Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse - Exclude root directory from git repository?

I'm trying to setup a git repository for my Eclipse project using EGit. However, I'm having trouble excluding the root/project directory from the repository. That being, my project has the structure:

ProjectDirectory
    src
    war
    etc

I would like the repository to contain src, war, and etc, but not contain the parent directory ProjectDirectory. That's because if I want to clone a copy of the project in my workspace, ProjectDirectory2, the repository for the second project now will try to create a second root directory, ProjectDirectory. Unfortunately, when I try to add a repository for a project using EGit, I seem to only be able to use Team > Share Project on the project folder itself and I don't seem to see anyway to exclude the root directory in the repository from within Eclipse.

Any suggestions on how to skip the top directory in the repository using EGit? I'd prefer being able to do everything from within Eclipse, but if there isn't a way, is there a way to setup the repository this way outside of git, then still be able to use the git control regularly from within git on the repository skipping the top level directory? Thank you much.

like image 205
golmschenk Avatar asked Mar 22 '13 14:03

golmschenk


1 Answers

Short answer is It is POSSIBLE with EGIT + M2E

trick is when doing share project -> in the configure git repo window

making sure use or create repository in parent folder of project is ticked

and making sure click create repository button

the main aim of this is to create the .git folder in you project root

not above your project root.

like image 178
Junchen Liu Avatar answered Oct 03 '22 03:10

Junchen Liu