2

I can't use any git commands, they all result in the following error:

fatal: unknown error occurred while reading the configuration files

Git was working fine up until I replaced my hard drive. I created a windows 10 system image and restored it on my new hard drive, and then combined the un-allocated disc space into my main partition.

I've tried re-installing and installing git, restarting my computer, and removing .gitconfig files, and pretty much every combination of those actions.

James Wierzba
  • 16,176
  • 14
  • 79
  • 120

4 Answers4

2

For me, the issue was .gitconfig folder/dir in Users//. Deleting the dir .gitconfig resolved the issue and it's working fine now.

the screenshot for solution

Melebius
  • 6,183
  • 4
  • 39
  • 52
chuha.billi
  • 159
  • 1
  • 6
1

(This should be a comment, but is too long to fit.)

Interesting. This error comes from function git_config_raw in config.c.

It suggests that do_git_config_sequence is failing without first complaining.

That, in turn, implies that git_config_from_file is failing silently, which would happen if the file exists but cannot be opened—which suggests perhaps some sort of issue that affects your access to the system, global, user, or repository configuration file, while still having the OS claim that the file exists and is readable.

Exactly what that (no doubt Windows-specific) problem might be, I have no idea.

torek
  • 448,244
  • 59
  • 642
  • 775
  • Do you have any suggestions for what else to try? – James Wierzba Oct 26 '16 at 20:26
  • No, I don't "do" (or even *have*) WIndows. I think it's the `fopen` call failing, after an `access` call succeeds, but what would cause that, I have no idea. (If this were a Unix like system, ktrace or strace or similar would let you find the failing system call and path and get you a lot closer to an answer, but it isn't.) – torek Oct 26 '16 at 20:27
0

What finally fixed it was setting the HOME environment variable to point to something reasonable. Once this was done, git started behaving properly again

Vivek Iyer
  • 364
  • 1
  • 4
0

Same problem here as well. It was fixed by deleting the git configuration file in the HOMEDRIVE / HOMEPATH folder.

dutchdukes
  • 385
  • 2
  • 9