James Wierzba
James Wierzba

Reputation: 17498

Can't use git: "git fatal: unknown error occurred while reading the configuration files"

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.

Upvotes: 2

Views: 3482

Answers (4)

dutchdukes
dutchdukes

Reputation: 395

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

Upvotes: 0

Vivek Iyer
Vivek Iyer

Reputation: 364

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

Upvotes: 0

chuha.billi
chuha.billi

Reputation: 179

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

Upvotes: 2

torek
torek

Reputation: 487755

(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.

Upvotes: 1

Related Questions