7

I commit a project on github using these steps :

Right click your project, select Team -> Share Project -> Git. Select the proposed line and press "Create repository". Press finish.

Right-mouse click on your project and select "Team" -> "Push". A dialog pops up. Maintain the following data. Adjust the hightlighted line so that you are using your user and your project name.

But when I view my project on github this is my project structure : myproject -> myproject -> src

When it should be : myproject -> src

So an extra level with the project name is being created on github. Am I commiting the project correctly ?

When I try to share the project with "Use or create repository in parent folder of project" enabled the project path is "c:\homedir\git\egit-test1\egit-test1" Should it not be "c:\homedir\git\egit-test1\" ?

Screenshot attached : enter image description here

blue-sky
  • 51,962
  • 152
  • 427
  • 752

2 Answers2

6

If you don't want the additional directory level in your git repository, you need to enable the "Use or create repository in parent folder of project" option at the very top of the "Configure Git Repository" dialog (Team -> Share Project... -> Git).

However, this will create the repository directly in your workspace and not in the default repository folder, which is not recommended. But you can move the project to the right place and re-import it into your workspace in a second step.

create repository in parent folder of project

Another option would be to create the repository on github first. Afterwards you can clone the github repository and move your code into it.

Stefan Ferstl
  • 5,135
  • 3
  • 33
  • 41
  • thanks, does it make sense not the have the "additional directory level" ? I'm assuming this is how other people use it, there is not case for having the extra level ? – blue-sky Sep 18 '12 at 10:34
  • @user470184 as long as you have a git repository for one single java project the additional level doesn't make sense. however, when you have multiple java projects in one git repository, the sub directories are helpful. – Stefan Ferstl Sep 18 '12 at 14:29
  • please see my question edit, when I try to share the project i don't think it should be displaying the project dir as shown in screenshot ? – blue-sky Sep 18 '12 at 15:41
  • @user470184 could it be that you already have a `.git` directory in your project (i.e. you already shared your project before)? in that case, egit finds the existing local git repository. if you share a project from scratch, the dialog should display the directory of your Eclipse project, e.g. `c:\homedir\workspace\egit-test1`. could you try it again by creating and sharing a new project? – Stefan Ferstl Sep 18 '12 at 21:32
0

i) pull code in local repository.

ii) copy code into seprate folder.

iii) delete all hidden files and .git .

iv) copy code again in your local repository.

v) commit and push

vaquar khan
  • 10,864
  • 5
  • 72
  • 96