-1

I am getting error fatal: bad config file line 12 in .git/config when I run any git command to do with git config, except when I am in /c/Windows/System32. I have tried running git bash as admin and it doesn't make a difference.

When I look at my .gitconfig file in /c/Users// it looks like:

[core]
symlinks = false
autocrlf = true
[color]
diff = auto
status = auto
branch = auto
interactive = true
[pack]
packSizeLimit = 2g
[help]
format = html
[http]
sslCAinfo = /bin/<file>
[https]
proxy=<internal proxy>
[user]
name=<name>
email=<email>
[sendemail]
smtpserver = /bin/<file>
[diff "astextplain"]
textconv = astextplain
[rebase]
autosquash = true

Of course with the <name>, <internal proxy>, <file> and <email> are replaced with the correct details. Also, the file has a file type of GITCONFIG File and is called .gitconfig.

My gitconfig file in /etc/ looks like:

[core]
symlinks = false
autocrlf = true
[color]
diff = auto
status = auto
branch = auto
interactive = true
[pack]
packSizeLimit = 2g
[http]
sslCAinfo = /bin/<file>
[https]
proxy=<internal proxy>
[user]
name=<name>
email=<email>
[sendemail]
smtpserver = /bin/<file>
[diff "astextplain"]
textconv = astextplain
[rebase]
autosquash = true

Again, the <name>, <internal proxy>, <file> and <email> are replaced with the correct details. In this case, the file has a file type of File and is called gitconfig.

Can anyone please help resolve my issues so I can continue running git commands?

Sascha Frinken
  • 2,274
  • 1
  • 19
  • 23
IdrisAH
  • 21
  • 4
  • Notice that the error points at a file named `.git/config`. Neither file you have posted here seems to be that file. – Code-Apprentice Nov 15 '17 at 16:33
  • The error message specifies that the problem is in the repo's local configuration file. This should only be possible when git perceives you to be in the working tree of a repository, so based on your report of when this happens I wonder if you have a `.git` directory at your `C:` root directory? – Mark Adelsberger Nov 15 '17 at 16:37
  • In any event, whenever you get this error you can say `git rev-parse --git-dir` and it will point you to a directory. `cd` to that directory, and you should find it contains a file simply named `config`. That file should contain the error (so if it's still unclear what's wrong, you'd need to post content of that file) – Mark Adelsberger Nov 15 '17 at 16:39

1 Answers1

-1

The answer to this questions is that I had not run git init inside the intended repository folder and therefore there was no repository.

IdrisAH
  • 21
  • 4