Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » How do I control where Eclipse gets the git config from?
How do I control where Eclipse gets the git config from? [message #1822924] Mon, 16 March 2020 21:03 Go to next message
David M. Karr is currently offline David M. KarrFriend
Messages: 800
Registered: July 2009
Senior Member
I feel like I've asked this question before, but I continue to have this problem.

I store my git config in "C:\Users\<myuid>\.gitconfig". Quite often, when I do things in Eclipse, it recognizes that this is where my gitconfig resides, and everything works.

Then there are the times when it seems to look in a completely different place, being "H:\.gitconfig". This is not very useful, as that drive doesn't even exist. When I look at env vars from the shell, I do see a "HOMEDRIVE=H:" property. I don't know what that's for, and it's not even SET in the Environment Variables section of Control Panel.

Eclipse doesn't give me the ability to specify where to get the .gitconfig from, it just makes up its mind somehow.

I'm using 2019-12.

What's even stranger is that it seems like it changed this in the middle of my session. I had performed operations on three different repositories, creating a branch in each and then pushing the created branch for the first two, and then attempting to commit and push a change in the third repository. On the commit/push on the third repository, I noticed that our git hooks reported a failure, saying my user/email settings were wrong. We have a hook on the server that requires our user and email properties to be in a specific format.

When I looked on the central bitbucket server, all three repos had the new branch, but the third repo was missing the commit I added.

[Updated on: Mon, 16 March 2020 21:24]

Report message to a moderator

Re: How do I control where Eclipse gets the git config from? [message #1822927 is a reply to message #1822924] Mon, 16 March 2020 21:33 Go to previous messageGo to next message
David M. Karr is currently offline David M. KarrFriend
Messages: 800
Registered: July 2009
Senior Member
I note that I just performed a Windows 10 upgrade over the weekend, from 1709 to 1809. I suppose it's possible that reset some hack I had set up to alleviate this problem.
Re: How do I control where Eclipse gets the git config from? [message #1822929 is a reply to message #1822927] Mon, 16 March 2020 22:32 Go to previous messageGo to next message
Matthias Sohn is currently offline Matthias SohnFriend
Messages: 1268
Registered: July 2009
Senior Member
This logic is implemented in JGit here
https://git.eclipse.org/r/plugins/gitiles/jgit/jgit/+/master/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java#171
if HOME is set explicitly it should be used otherwise JGit uses $HOMEDRIVE/$HOMEPATH
Re: How do I control where Eclipse gets the git config from? [message #1822930 is a reply to message #1822927] Mon, 16 March 2020 22:32 Go to previous messageGo to next message
Thomas Wolf is currently offline Thomas WolfFriend
Messages: 576
Registered: August 2016
Senior Member
JGit uses .gitconfig in your "home" directory. To determine the "home" directory JGit uses on Windows in the following order:

  1. %HOME% if set,
  2. %HOMEDRIVE%\%HOMEPATH%, if %HOMEDRIVE% is set,
  3. %HOMESHARE% if set,
  4. Java system property "user.home".

Easiest way to tell EGit/JGit where your home directory is is to set the environment variable %HOME%.
Re: How do I control where Eclipse gets the git config from? [message #1822932 is a reply to message #1822930] Mon, 16 March 2020 23:58 Go to previous messageGo to next message
David M. Karr is currently offline David M. KarrFriend
Messages: 800
Registered: July 2009
Senior Member
The problem is, I can't set that. I have Cygwin installed, and that sets it to a cygwin-specific path. I also can't set the other HOME... variables because that's set by my work infrastructure.

This is dead in the water. If I can't fix this, I won't be able to commit or push changes from Eclipse anymore.
Re: How do I control where Eclipse gets the git config from? [message #1822933 is a reply to message #1822932] Tue, 17 March 2020 00:26 Go to previous messageGo to next message
David M. Karr is currently offline David M. KarrFriend
Messages: 800
Registered: July 2009
Senior Member
Well, I've managed to figure out a hack that at least works. I had to write a short batch file that sets HOME to the expected Windows HOME, then it executes its command-line parameters. I then have to edit the Eclipse shortcut, adding the full path to this batch file at the front, and then finding the eclipse.exe file and getting the icon from it. I'll have to do this for every Eclipse distribution that I install.

I'd really rather not have to do this.
Re: How do I control where Eclipse gets the git config from? [message #1823324 is a reply to message #1822933] Tue, 24 March 2020 22:31 Go to previous message
Matthias Sohn is currently offline Matthias SohnFriend
Messages: 1268
Registered: July 2009
Senior Member
Maybe you want to contribute a patch improving this for cygwin ?
I neither use Windows nor cygwin.
Previous Topic:egit/github/updates is no longer a valid repository
Next Topic:EGit now forcing GSSAPI-WITH-MIC?
Goto Forum:
  


Current Time: Fri Mar 29 01:27:11 GMT 2024

Powered by FUDForum. Page generated in 0.03389 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top