|
Re: newbie import from git repository question [message #705058 is a reply to message #704624] |
Fri, 29 July 2011 11:29 |
R Shapiro Messages: 386 Registered: June 2011 |
Senior Member |
|
|
You did too many steps here. In particular you imported twice, and also created an entirely new project.
If the external Git repository is already configured as an Eclipse project (that is, it includes a .project file), and all you want to do is make a local clone you can work with, do the following:
1) Go to the "Git Repositories" perspective. Note the three toolbar items with "Git" in the name. Click the middle one, the one whose tooltip says "Clone a Git repository and add the clone to this view". By default the clone will be added in ~/git (or equivalent in Windows). You can put it wherever you want though. You can also change the default location in the egit preferences (Preferences -> Team -> Git, "Default Repository Folder").
2) Now you should have an entry in the Git Repositories list referencing your new clone. Click right on that entry and select "Import Projects..."
That's it, you're done.
If you already have a local clone, then in step (1) use the first Git toolbar item from the left instead, the one whose tooltip says "Add an existing local git repository to this view". Then proceed with (2) as above.
If the repository is not yet configured as an Eclipse project and you want to turn it into one, that's a different kind of question, not specific to egit. Basically you need to add a .project file of the right sort and commit it, along with other Eclipse metadata specific to the project type (Java projects need a .classpath, C++ projects need a .cproject, etc). Eclipse will help you configure the other files once it knows what kind of project you want it to be.
|
|
|
|
Re: newbie import from git repository question [message #706734 is a reply to message #706515] |
Sun, 31 July 2011 20:36 |
R Shapiro Messages: 386 Registered: June 2011 |
Senior Member |
|
|
Creating an Eclipse from an existing directory is not hard, it's just off-topic. But here's a quick summary of how you can do that for a Git repository containing Java code. I'm assuming here your Eclipse includes the Java plugins. If your project is CDT/C++ or Python or whatever, adjust accordingly.
Run File -> Import -> Git -> Projects from Git. Then in the next panel pick 'Add', not 'Clone'. You already have a local clone, the one in "H:/Documents and Settings/Alberto/git/imagej2". The reason you got a second copy is that you cloned it.
Or you can use the Git Repositories view, as I described earlier to get at the existing clone.
At this point egit knows about your local clone. Since there's no .project file yet use the option "Import as General project". You can't "Import existing projects" because there aren't any yet, and you don't want the "New Projects wizard", since that will create an entirely new tree. Instead you want to convert the existing tree.
At this point you should have a generic eclipse project in your workspace. It will contain all the files of your local clone plus one new one called ".project".
Now right-click the project root and select Configure -> Convert to Faceted Form. This is how you can convert a General project into a Java (or C++ or Python or whatever) project. In this case the "Java" option should appear, since we're assuming your Eclipse includes Java support. Check that box if it isn't already checked, and proceed.
At this point you should have an Eclipse Java project. All that's left is to configure the build-path in the usual way: Build Path -> Configure Build Path. Here you can set the dependencies, specify the source directories, etc. For Java projects this step will add a file called '.classpath' and a directory called '.settings' with two files in it. For C++ projects it will add a .cproject and .settings.
Add the new files to Git, commit to your clone, and then push back to the origin so that your fellow developers don't have to go through all this.
As for "Share", you don't need to do it, as egit already knows everything it needs to. The purpose of "Share" is to tell Eclipse what repository you're working with. This can be handy for imported CVS or SVN projects but isn't generally necessary for Git or Mercurial.
|
|
|
Re: newbie import from git repository question [message #706765 is a reply to message #706734] |
Sun, 31 July 2011 21:28 |
R Shapiro Messages: 386 Registered: June 2011 |
Senior Member |
|
|
<sigh>Too much context here distributed around. I hate forums for just this reason. Ignore my previous response, let me try again...</sigh>
Start like you did before:
Run File -> Import -> Git -> Projects from Git.
Click "Clone" and enter git://pacific.mpi-cbg.de/imagej.git as the repository. This will create a local clone of that repository.
When the clone is complete, select the newly added clone and click "Finish".
Or if you want to do all the steps manually, click "Next" and use the option "Import as General project". You can't "Import existing projects" because there aren't any yet, and you don't want the "New Projects wizard", since that will create an entirely new tree. Instead you want to convert the existing tree.
Either way, at this point you should have a generic eclipse project in your workspace. It will contain all the files of your local clone plus one new one called ".project".
DO NOT DO ANOTHER IMPORT. This is where you went wrong last time.
Now right-click the project root and select Configure -> Convert to Faceted Form. This is how you can convert a General project into a Java project (or C++ or Python or whatever). In this case the "Java" option should appear, since we're assuming your Eclipse includes Java support. Check that box if it isn't already checked, and proceed.
At this point you should have an Eclipse Java project. All that's left is to do any project-specific configuration. For a Java project you would want to configure the build-path. Other kinds of projects would have other sorts of configuration. The configuration step will probably add more files. For a Java project it will add .classpath and two files under .settings.
Add the new files to Git, commit to your clone, and then push back to the origin so that your fellow developers don't have to go through all this.
As for "Share", you don't need to do it, as egit already knows everything it needs to. The purpose of "Share" is to tell Eclipse what repository you're working with. This can be handy for imported CVS or SVN projects but isn't generally necessary for Git or Mercurial.
|
|
|
|
Powered by
FUDForum. Page generated in 0.02662 seconds