Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GitHub error "fatal: bad config file line 1 in .git/config" when in git shell

Im using GitHub on Windows and after working fine for the whole time, when I opened it today, it says:

Failed to load commit history for this repository. You might need to open a shell and debug the state of this repo.

And then:

Failed to get list of branches.

When I open shell and try git status or whatever other command, it returns this error :

fatal: bad config file line 1 in .git/config

Not sure what to do with that? I read someone saying to replace the config file with an earlier version of it, but I dont have an earlier version..

like image 216
Dom Avatar asked Nov 22 '14 02:11

Dom


2 Answers

I solved this by

  1. open .git/config file
  2. clear all the NULL values in the file
  3. save and close the file
  4. git add .
like image 139
Issaka Faisal Avatar answered Sep 18 '22 04:09

Issaka Faisal


I was with Visual Studio Code and facing the same issue. I went to ".git>config" file and cleared that file, saved it. enter image description here

That fixed the issue.

like image 37
Raghav Avatar answered Sep 18 '22 04:09

Raghav