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

I'm using GitHub on Windows and after working fully for the entire time I opened it today, it says:

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

And then:

Failed to get the list of branches.

When I open a shell and try to execute git status

or any other command, it returns this error:

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

Not sure what to do about it? I read what someone said to replace the config file with an earlier version, but I don't have an earlier version.

+3


source to share


4 answers


My question might have been vague, but I wasn't sure what happened. I solved it by finding the .git / config file on my laptop using Windows search and deleting it. Then I deleted the contents of my github folder and cloned the repo again and it worked after :)



+7


source


I had the same problem and removed the .gitconfig file from the local repository. The problem has been resolved.



+2


source


I solved this on my mac

  • created a .gitconfig file in $ HOME folder (cmd + shift + h)
  • added [user] name = myname email = myemail@example.com

    to .gitconfig file
  • saved and replaced with an existing file

now all git commands started working

+2


source


I solved it

  • open .git / config file
  • remove all null values ​​in the file
  • save and close file
  • git add.
+1


source







All Articles