4

Current scenario :

In Eclipse when we create a project, say a PyDev project named ‘SimpleGit’, the folder structure created by eclipse will be like

EclipseWorkingDirectory/SimpleGit/src/
correct?

If we add this to git using Egit, by right clicking on the project folder SimpleGit then Team>Share, The folder structure in which repo is formed like this

Parent Folder/ SimpleGit/ .git

Parent Folder/ SimpleGit/SimpleGit/src/

And when we stage it to remote github everything will come under

Username/ SimpleGit / SimpleGit / src /

So when we look in GitHub in the root project folder (Username/ SimpleGit) we can’t see the source folder. It will be under another folder ‘SimpleGit’. How we can avoid this? What I want is , I want to get my source forlder(src) listed under the Project Root directory, when staging from an already built project in eclipse using egit. How do I do this?

I want like this: https://github.com/nicholasbishop/blender

Not like this: https://github.com/afilash/SimpleGit

1

2 Answers 2

2

it cannot be done using eGit - it assumes the Eclipse project structure.

But it can be accomplished by using git itself. Just create a repository under SimpleGit folder executing 'git init'. From that point on you'd have to manage your git repository by either git itself (command line) or some other UI. SourceTree works really well for me.

Sign up to request clarification or add additional context in comments.

2 Comments

It can be done, I found a work around (It is crooked ). What you have to do is create a project in both eclipse and github. Then copy the ".projects" files from eclipse to github root directory(not using egit just copy paste). Delete the project folder in eclipse. Clone the project from github to your local as usual. next time when you commit, Every thing will be like what you want.
I realize that this is exactly what you asked for. But what is the point of having only source code in your repository? Almost every project has more resources - tests, build scripts etc. So IMO it makes sense to have src and other folders in your project
2

It is a bit late, I know, but this method perfectly works and I hope it is useful for anyone who sees this post from now on.

The procedure is the following:

  1. First step is creating a repository on Github (through github.com)
  2. Move to Eclipse IDE (Git Repositories view) and click "Clone a Git Repository and add the clone to this view". Doing that the project will be somewhere located on the hard disk. Usually, it is stored in C:\Users\username\git\projectName but you are able to change it. This is our local repository.
  3. Once done, press (in Eclipse IDE) File->Import->Projects from Git->Existing local repository(Select the one you cloned before)->Import using the new project wizard->Finish->Java->Java Project->Specify project name (just below the dialog box there is a checked checkbox that says use default location, uncheck it. Here is where you have to specify the directory you chose while cloning the repository previously).->Next->Finish

It should be enough for creating the right directory structure.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.