Why does Eclipse show a Git repo for a Working Set? - eclipse

Whenever I open a project in Eclipse (4.2.1) that is connected to a Git repo, the Git repo description [Name branch] is displayed by the Working Set that project is in.
Example:
If I close the TestSlide project (that has the repo of the same name), the [TestSlide master] will be gone. And when I open another Git-connected project, then its repo name/branch will be printed beside the Working Set.
And when there are several Git-connected projects opened in the Working Set (all coincidentally pointing to master branch), this is shown:
Even though there are several projects in the same Working Set that are connected to SVN repos, never are their repo names shown beside the Working Set name.
Somehow I believe this is not intended (by Eclipse), so is it something I "misconfigured" in Eclipse so I can fix it to get rid of this annoyance?

Related

Git hub project _ Learning)

I am working on a simple project to learn github. After I worked on my project in eclipse on my local computer, I pushed my project to github for other teammates. A second member of my team pulled this project from github and pushed back to github after making some changes. Now this morning I want to pull this updated project from github to my local machine (eclipse) so I can work on this updated project.
How can I pull this updated project from github to direct into eclipse on my local computer .
I am tried to do:
"git clone http://github.com/testproject/gitDemo.git" but it is not directly going to eclipse. If I save this project on my machine and then try to import into eclipse I got error message, "can not import, there is already one project exist with same name".
I did not see pull option in eclipse under:
Right click on project - team - Pull
Any suggestions??
Thank you in advance for all your help
I'll make one point that I'm not certain you do NOT understand, but as I often see this misunderstood, I'll point it out.
You should separate the notion of "git repository" and "project". When you clone a git repository from github (or bitbucket, or some central repository), you should store it in a directory tree outside of your Eclipse workspace. You then should right-click on the repository and select "Import..." to create a project from the contents of that repository.
Related to that, you should look for the "Pull" operation on the repository entry, not the project. I recommend to display the Git Repositories view on the left side, below the Package/Project Explorer, and make sure that you attempt all git operations in that view, instead of the Package Explorer view.
The only detail from your original post that I can address is the error about already having a project with that name. That error message is not ambiguous at all. You already had a project with that name. I have no idea whether that project was a copy of the repository that you had somehow already imported, or whether it's an empty project, or what. You don't provide any information about that.

Pulling a project from GitHub with EGit

I've setup a private GitHub account to make it easier for me to work on the same project on both my desktop and my laptop when I'm not at home. The project was originally on my laptop, so I configured EGit to push and commit to my private repo. That worked successfully, and now I can see my project when I log onto GitHub. I'm now trying to pull that project onto my desktop. I did the same configurations , and in the Git Repository View within Eclipse I can see Remotes->origin-> the Push/Fetch streams. I tried to fetch, and that placed an origin/master branch under git\branches\Remote Tracking. But I can't seem to do anything with it.
I'm not sure what to do next, or if I made a mistake somewhere?
Now just right click it and Create branch.... This will make a local branch that will track this remote branch. When you push Eclipse should automatically configure everything so that origin/master will get updated.
Check out the local branch to start working.
UPDATE:
To import the project from working copy select the following:
If you have checked in your configuration files (.project, .classpath etc) you will get a list of all available projects in the repo to import to workspace. If not you will need to import them manually.

How can I start a project on GitLab repo with Eclipse?

Good morning.
I just create a GitLab private repo to work in a project with some people. When I add GitLab repo to Eclipse, it says there aren't projects (and it's true). I would know how to create a project and sync with online repo so other members can see my project and codes.
I tried to start a project in git\repoName\ folder, then right-click and choose Team->Commit, but changes wouldn't save (in gitLab repo's website, it says "Repo is empty").
I tried to follow some online guides, but without success.
Sorry for bad english!
Eclipse 4.2 and newer, comes default with (E)Git installed. There is a good Eclipse git tutorial from Vogella.
Create a GitLab git repository
Log into GitLab
Create a project / git repository
Copy the https url from the project, used for cloning
Adding an GitLab git repository in Eclipse
Open the Git perspective in Eclipse
Use Clone existing Git repo, as shown in Using git repository view
Now all the git functionality from Eclipse can be used.
I assume you have a cloned repository available in Eclipse (eGit) that is empty. If not, follow the steps in the answer from Verhagen.
By now, you have a cloned repository that is marked with "[NO HEAD]", indicating that no commit has been made.
Start creating a new project by using your project type of choice; I'll use Java project for simplicity: File menu > New > Java project
in the New Java Project wizard un-tick the "Use default Workspace location" checkbox; instead, choose the directory where you cloned your empty GitLab project, and append the name of the project (this is to make Eclipse create a directory inside the repository, just in case you later want to create more projects in the same repo).
Fill in the wizard as you usually do. When you are done with the different steps, you'll have a new project, that is also marked with "[NO HEAD]"
Create some source files you want to share (e.g. HelloWorld.java)
Synchronize workspace (right click on the new project > Team > Synchronize workspace) you will see that now there are files to commit. Pay attention to those files, since some of them ( .gitignore, and maybe .classpath, .project,.settings directory... depending on how you share your projects) you'll want to add to the .gitignore.
right click on the files you want to commit, fill in the commit message and click "Commit and Push". Click Next
Since it is a new repository, you'll have to configure the Push action. I selected HEAD as source and HEAD as destination. You might want to do the same, at least for this first commit+push; later on, you might choose to add some specs for branches, etc.
The Push Confirmation will show you that the new branch master:master will be created.
Both project and repository lost the "[NO HEAD]" marking
You can check gitlab site to confirm your files are there.

Confusing Eclipse and Github interactions

We are trying to use Eclipse and github on a project, and it is proving to be a real burden because we do not understand how it works. It is difficult to formulate a single question, but let's start with one case:
We have a project in Eclipse that is on github. Several developers are sharing the archive. We learn that we want to create a Java EE project rather than a Java project. We do not want to change the name of the project. How can this be done?
Further, not knowing this, we tried to change the name from ProjNamet to ProjName2.
When creating a project on git, Eclipse creates it in a local directory:
c:/Users/username/git
In order to push that project out to github, we executed:
git remote add origin github.com/author/projname
git push origin master
As far as we can see, the project appears to be successfully pushed out to github.
In addition to source code, there is:
.project
.gitignore (which just ignores the build directory)
.classpath
.settings
But when I right click on the repository and try to import projects from it to my computer, Eclipse failed
deleting the directory, and clicking on File->import.. and importing from the repository works.
I do not see what the difference is between the one that worked and the one that did not.
Try this:
git remote add origin github.com/author/projname
git push origin master

EGit greying out / not showing commit

I've been running into a wired problem (which has been described (but not solved) here as well:
I used to develop using PyDev and Egit (recent versions, EGit is 3.0.3) with just a local repository. Everything worked fine, I was able to commit, branch, reverse etc. just using the "Team" menue in my PyDev perspective.
Now I added a remote reposisory to host the project and since then, I can not commit to my local repository. File changes are not detected (even worse: I change file A and afterwards all folders are marked as "changed" (having the ">" icon) and no file is recognized as "needing synchronization". The only menu points which are available are "Add to index" (which has no effect) and "Pull" (which says "everything is up to date" - which is true since there is nothing new on the server to pull).
When I use git (either command line or git extensions), I see the changed file as changed and it's offered for staging. I can use plain git to commit, push, etc, everything works as expected and no error messages are shown. I'm just using one branch (master).
Even if I open the "Git Repository Exploring" perspective in Eclipse and got to the tab "Git Staging", the file is listed.
I jus started a new test project with just a local repository (residing in the same git-folder ~/git) and here I can commit as I'm used to... And I added the project to the same repository server - and still everthing works! I can commit, I can push, everything is fine there...
yes, I can work around hat by using git extensions, but I really liked the smooth integraion of git in eclipse. Therefore, all ideas, remarks etc. are very welcome! And yes, I tried restarting eclipse ;o).
Finally!!!
Since everything was working before I added the remote host, amd everything worked in my small toy project, I removed and re-added my remote host using gut bash:
git remote remove origin
git remote add origin git#my_servername:my_repository.git
I suppose some configuration files were corrupted in a very non-obvious way (I checked all config fiels and did not notice anything...)
Sounds like a bug, and you might be able to get it back to a good state by playing around with the plugin setting data.
Located here: ${workspace}/.metadata/.plugins
I highly recommend backing up that whole folder before you start playing around. I have had other eclipse issues that have been resolved by going in here and deleting things.