Eclipse Git Configuration System Settings is disabled - eclipse

I'm working with Eclipse Mars, on Windows 7 64 bits and I recently discovered that when I clone a repository using eclipse built-in git clone feature, CRLF are not added to the files, and they are cloned with only LF at the end.
I checked Eclipse config for Git (Team > Git > Configuration) and I found that System Settings is empty and all buttons disabled and it says "Unknown" in the Location field.
I have Git for Windows 2.5.0 64 bits installed. Apparently now the system gitconfig file should be under C:\Program Files\Git\mingw64\etc but by default there is no file there.
I discovered that if I manually populate it from cmd (git config --system core.autocrlf true) it will be created, but still can't select it from Eclipse.

You need to tell EGit where the default system configuration is for it to be able to pick up the values. There's a Browse button which should allow you to change it according to the help pages:
https://wiki.eclipse.org/EGit/User_Guide#Pointing_out_the_System_wide_configuration
You can also set this property in the User Settings which Eclipse will respect. Global is 'for all users of this machine' and User Settings is typically stored in your home directory, i.e. 'for just this user'.
You'd have to find where the file that's being created by git config --global on your setup is. It's likely that git isn't on the path, and that's why Eclipse can't auto-guess where it should be.
By the way, unless you really, really need to have CRLF on the files you should prefer to keep them as how they are stored remotely - it will be faster for EGit and Git to perform deltas if it doesn't have to do line-ending conversion on most operations.

I had a similar problem so let me add this for clarification: in Eclipse Preferences > Team > Git > Configuration the System Settings Tab was empty and "Location:" said "Unknown". The EGit User Guide (https://wiki.eclipse.org/EGit/User_Guide#Pointing_out_the_System_wide_configuration) tells that "If you selected one of the options to use Git from the Command Line Prompt when you installed Git for Windows, then the location of the system wide settings is filled in with a path and everything is fine. If not, use the Browse button to locate where Git is installed, e.g. C:\Program Files(x86)\Git." Indeed I did not select the option to use "Git from the Command line ..." when I installed Git. But instead of a "Browse" button my Eclipse 2020-09 has an "Open" button and that one was GREYED OUT, so I was unable to tell EGit in the above mentioned "System Settings" Tab where the local Git installation could be found. Furthermore I did not know which path precisely had to be added to the systems PATH variable.
I then reinstalled Git with the option to use "Git from the Command line ..." and found out that "C:\Program Files\Git\cmd" was added to the System PATH. After a restart of Eclipse the "System Settings" Tab had the "Location" configured as: "C:\Program Files\Git\etc\gitconfig" and all the missing keys and corresponding values were set.

Related

How to reconfigure Eclipse egit after move from Linux to Windows?

Problem:
I moved an Eclipse project from a Linux machine to a Windows 8.1 machine but cannot get the Git repositories to load on the new Windows Box. I use eGit within Eclipse (and am NOT a sophisticated user of GIT).
I moved the projects from the Linux box to the Windows box by manually copying the entire project directory and all sub-directories. My Git/eGit files seem to be stored, for example, in
D:\TheUser\Programming\eclipse\project1\project1gui\.git.
When I launch Eclipse on the Windows box, I get an eGit error and none of my repositories open. The error is:
java.nio.file.InvalidPathException: Illegal char <:> at index 66:
\home\TheUser\Programming\eclipse\project1\project1gui.git:\home\TheUser\Programming\eclipse\project2.git:\objects
NOTE: the paths in the error seem to be the old Ubuntu/Linux paths.
I understand the error, there is a Windows invalid character in the path, but I simply cannot find a config file or other means to reconfigure eGit manually (I don't want to lose my repositories).
Specs:
Eclipse Kelper SR2
JDK 1.7
Windows 8.1 x64 Pro
(Moved from Ubuntu x64)
In case anyone else stumbles on this from Google (Like I did), the problem is that the path separator in your .metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.egit.core.prefs is wrong. (That's from the root of your workspace)
So, if you open that file with the editor of your choice and replace all ":" characters in GitRepositoriesView.GitDirectories and GitRepositoriesView.GitDirectories.relative with ";" and restart Eclipse, things should start working again.
I had same issue on Eclipe Version: 2019-03 (4.11.0).
The root cause looks to be that default ${user.home}/.ssh is appending the new location of your keys with an extra \ at the end. This may be a Eclipse bug in 2019
The solution I used was to go to Preferences -> Network Connections -> SSH2 and overwrite
the SSH2 home with new folder where I put the correct ssh key to connect to git and now is working fine.
You need to go into the .git/config file in your repo, and modify the remote to point to the new url.

EGit Compare shows all lines as changed

Just installed Eclipse 4.3 (Kepler) which comes with EGit (which I updated to EGit 3.2.201312181205-r), and Git for Windows. I cloned a repository in the Git for Windows Bash shell under an existing Eclipse workspace, and then in Eclipse imported it as a project. However, if I right click a file that I haven't changed and select Compare With > HEAD Revision, it shows all lines as different.
In the Git for Windows bash shell, git diff on the file shows nothing. Running od -c on the file in Git bash shows it has Windows-style line endings.
When I go into Eclipse preferences for Compare/Patch and say to ignore whitespace, it shows no differences. But I'd like to understand why that is necessary.
What is really being compared here?
This is a know bug in Egit. https://bugs.eclipse.org/bugs/show_bug.cgi?id=342372
Even in Egit 3.4 (planned for June 2014) it won't be fixed. Robin Stocker gave this suggestion in the duplicate of the above bug:
Until this is implemented, I recommend this setup:
For each Eclipse project, go to Properties > Resource and change "New text file line delimiter" to Other: Unix. Commit the resulting
.settings/org.eclipse.core.runtime.prefs files.
Don't configure any .gitattributes or "core.autocrlf" for Git. This means that files will have the same line endings in the working
directory as in the repository. Git and EGit will not convert any file
contents.
With 1., all new files that are created in Eclipse will have correct
(LF) line endings, even when created by a user on Windows.
For files that are already in your repository with CRLF, you can fix
them and commit the result. I recommend using dos2unix or fromdos on
the command line.
However it's been reported that Egit ignores these settings when importing a project. https://bugs.eclipse.org/bugs/show_bug.cgi?id=421364
So it looks like all developers need to check the line endings themselves. But least you don't need any other tools to fix this. Under the File menu in Eclipse there's a: "Convert Line Delimiters To". Also note there are line ending settings for both individual projects and in the workspace settings.
For projects: right-click -> properities -> Resource
For Workspace: Window -> preferences -> General -> Workspace

Eclipse project-wide error: Warning: The environment variable HOME is not set. The following directory will be used to store the Git

Started Eclipse and got this error. How do I fix it?
Warning: The environment variable HOME is not set. The following directory will be used to store the Git
user global configuration and to define the default location to store repositories: 'C:\Documents and Settings\Wizard'. If this is
not correct please set the HOME environment variable and restart Eclipse. Otherwise Git for Windows and
EGit might behave differently since they see different configuration options.
This warning can be switched off on the Team > Git > Confirmations and Warnings preference page.
If any additional information is needed, let me know and I will provide it.
The other answers don't contemplate that if you don't use Git, then you can entirely ignore this warning, along with the "EGit could not detect" one.
But I know... obsessive minds can't just ignore... they NEED to fix it anyway, right?
Then proceed:
Go to "Window --> Preferences" menu
Expand: "Team --> Git --> Confirmations and warnings"
Uncheck the "Home directory" and "Git prefix" boxes
Ok
In the Workspace log, delete the old warnings (red cross icon)
Restart Eclipse
Feel the peace spreading through your mind... :)
You need to set the JAVA_HOME variable in your system.
Depends on your Operating system you can check for "How to set Environment variable?" and from that point you need to set environment variable
Variable Name : JAVA_HOME
Value : Path of Java upto bin folder
In Windows 7, type "environment" at the start menu
Select "Edit environment variables for your account"
Click the "New" button.
Enter "HOME" in the name field
Enter "%USERPROFILE%" or some other path in the value field.
Click OK, and OK again. You have just added the Home directory on Windows.
This is a warning because the HOME environment is not defined, whereas EGit (plugin for Git) need it to know where to locate the Git configuration and repository. By default it will use the current user base directory but the risk is that if you have Git installed at a different location, EGit and Git may have different behaviors. If you don't use Git, just deactivate the warning as explained.
Here is the EGit user guide : https://wiki.eclipse.org/EGit/User_Guide#Setting_up_the_Home_Directory_on_Windows
It explains that you have to set the HOME variable with the %USERPROFILE% as value.
You may check that too http://git-scm.com/book/en/Getting-Started-First-Time-Git-Setup
and Changing .gitconfig location on Windows
You should study the official documentation
Setting up the Home Directory on Windows
Add the environment variable HOME to your environment variables.
In Windows 7:
type "environment" at the start menu.
Select "Edit environment variables for your account".
Under "User Variables", click the "New" button.
Enter "HOME" in the name field.
Enter "%USERPROFILE%" or some other path in the value field.
Click OK, and OK again. You have just added the Home directory on Windows.
File > Exit, then restart the application.
This is because JEE package is lacking the Platform SDK. (there is "Eclipse Platform Plug-in Developer Resources" in Eclipse IDE for Eclipse Committers(former Eclipse Standard), but not in Eclipse IDE for Java EE Developers.)
You can solve this bug by installing it manually from "The Eclipse Project Updates" site. (Help->Install New Software->choose "The Eclipse Project Updates"->uncheck "Group items by category"->select "Eclipse Platform Plug-in Developer Resources")
(for EGit warnings, they are just warnings and have no relation to this problem)
There is no need to set an environment variable HOME or JAVA_HOME for the system or for any user. The required data can easily be given to eclipse or Git or EGit in a small script:
- Use your brain to make out where the HOME for ecilpse or Git or EGit should be. You
can choose any directory accessible for these programs.
For example the directory is N:\somewhere\eclipse\HOME.
- Examine the location of the executable eclipse file.
- Open a new text file with the Editor or with your favourite text editor app
on your desktop or in any directory you like.
- Write the following text of 3 lines
SET HOME=N:\somewhere\eclipse\HOME
start "Run Eclipse" "F:\ProgramFiles\eclipse\java-2019-03\eclipse\eclipse.exe"
EXIT
Here N:\somewhere\eclipse\HOME is just an exmaple for any existing directory
you choose.
"Run Eclipse" is an example for the title of the script window.
"F:\ProgramFiles\eclipse\java-2019-03\eclipse\eclipse.exe" is an example for
the exclipe app to start.
save the text file as "RunEclipse.cmd"
By executing RunEclipse.cmd you set the HOME environment variable only for this
script. eclipse.exe can get it from the script environment and the Error does
not occur anymore.

Eclipse + Git - How to get toolbar?

I've got Eclipse 3.7.2 installed and working fine. I installed the git plugins (see below).
Right clicking my active project and clicking on "Team" gives me the options to pull/push/commit and more.
I have set my git executeable to msysgit (C git).
The docs told me that to add git to the toolbar I should look in Window->Customize Perspective..., but I couldn't anything related to git there, not even under the "Command Groups Availability" section.
How do I add push, pull & commit buttons to my Eclipse toolbar?
Stumbled on this answer, but found this works:
Install the Egit plugin, add the Git command group in Customize Perspective|Command Groups Availability, not the (pretty much useless) "Team", then check "Git" in Customize Perspective|Tool Bar Visibility
First install EGit from http://download.eclipse.org/egit/updates. Then you should find the Git command group and be able to activate it. msysgit isn't integrated with Eclipse.
See "Activating the Git toolbar "
Nothing worked and I had begun getting an unrelated error on startup with a troubleshooting step requiring reinstall.
This time I downloaded Eclipse for Mobile Developers, and since then I have added my other packages and it's all working, but clicking the commit thing and clicking the arrow to merge my changes (with comment) results in nothing.
It isn't committed nor is an error given.
install a fresh copy of eclipse with a new fresh workplace
install egit
show egit in toolbar (from customise perspective, etc....)
copy \.metadata\.plugins\org.eclipse.e4.workbench\workbench.xmi from the fresh installed workplace into your current workplace
you'll loose some position settings of the layout, but most of the settings will be kept, and most important you'll have egit in toolbar in your current workplace.
if you like you can analyse/diff the file workbench.xmi and see what you have to set to get the toolbar; for me it was enough (most likely workplace was from previous versions of eclipse, and egit/eclipse does not update this xml file)

How do I delete all directories matching a pattern using SVN?

I have checked in a huge Eclipse project from my desktop computer to the SVN server. I did it using the command line. However, by mistake I committed all the compiled classes also in the server.
For every plug-in, there is a directory /bin/ that contains the compiled classes.
Is there a way to quickly delete in the server all directories that match this pattern using the command line?
Additionally, is there a way to tell svn to ignore bin directories by default?
From here (for the 'additionally part'):
Click on Window -> Preferences
Select Team -> Ignored Resources
Click on Add Pattern and enter "bin"
Click on Apply and then OK
For the bin directories, do you have svn 1.5 ?
Because if you do, 'svn rm --keep-local' allows to pull them from version control but not delete it from your machine.
You can do it with Tortoise (Delete (keep local))
To add to what VonC suggests, if you're using the command line, you can edit your configuration file (and change your global-ignores entry) here:
~/.subversion/config
or in the windows registry:
HKCU\Software\Tigris.org\Config