-1

I'm using Eclipse with PyDev and EGit plugin to manage my projects. All my current projects are stored as PyDev projects with the source code stored as Python pacakges in a src folder:

enter image description here

I want to clean up my code and use GitLab for version control. I have created a new project under my GitLab profile:

enter image description here

I have then imported the GitLab project (repository) into Eclipse via Egit:

enter image description here

I then created a new PyDev project in Eclipse with a new Python package called geoHydro and selected the newly imported GitLab repository. I then commited and pushed the changes to my GitLab remote repository:

enter image description here Initial commit and push to GitLab repository

enter image description here

Pydev project under version control

enter image description here

Hierarchy of project structure in GitLab

I don't understand why there are repeated geoHydro folders, surely the Pydev project folder doesn't need to be cloned under GitLab. I'm not sure if I'm doing something incorrect as I followed all the necessary instructions under PytDev, EGit and GitLab.

My GitLab project structure should be at least:

src\geoHydro and the Python modules within the Python package directly under the GitLab project folder. Any help with the following will be appreciated.

Peter Wilson
  • 1,075
  • 3
  • 14
  • 24
  • I think the error lies somewhere around the "I created a new PyDev project" step. Please provide more details on this. – oberlies Mar 10 '17 at 09:32

2 Answers2

1

This is happening because you're creating a new project under that existing repository (so, it did what you asked, but that's not what you want, you'd want to write in the existing git dir, not in a new project in a subfolder -- it'd probably work if you specified the parent directory which already contained the geoHydro repository dir).

You can do the following with your current structure: delete the project from Eclipse (without deleting the contents), move all the contents from geoHydro/geoHydro to geoHydro, import the geoHydro project in Eclipse again (using File > Import > Existing projects into workspace) and commit the contents as they are now.

Fabio Zadrozny
  • 24,814
  • 4
  • 66
  • 78
0

I do not use neither PyDev nor EGit but maybe it would be a better option to open terminal, navigate to the folder of your project and execute following commands:

git init
git add .
git commit -m "Some comment"
git remote add origin <remote repository URL>
git push -u origin master

remote repository URL you can obtain at GitLab for your repository.

Also, if you are not the only one developer working on project it is a bad practice to push IDE specific settings files and folders to VCS - so maybe think about to create an .gitignore file. There are many examples on internet of this files for python.

nick79
  • 417
  • 3
  • 7
  • I think this approach can work well, but I disagree that it's a bad practice to push IDE specific settings to VCS (in this case `.project` and `.pydevproject`... it makes the life of other IDE users much easier later on without any real shortcoming (i.e.: why have everyone reconfigure the PYTHONPATH used for the project manually, expected python grammars to be checked, etc. if it could be pre-configured for you by having those files committed)? – Fabio Zadrozny Mar 15 '17 at 13:54
  • Well it depends - if all developers within company use same IDE than maybe it is OK, otherwise if I use Sublime for example, I do not want to checkout .idea folder for example. Also, even though all developers use the same IDE, maybe I do not like a setup of other developer or vice-versa. So I belive that it is better that every developer set up project on his own. – nick79 Mar 24 '17 at 13:42
  • I still don't agree (why would you be bothered by some file which would make someone else's life easier, even if it's a single developer -- I get that you don't care about it, but then again, you can just ignore that in your own workflow for all practical purposes). – Fabio Zadrozny Mar 24 '17 at 16:30