fatal: bad config line 10 in file .git/config means Git could not read the line it names in that config file, and it refuses to run until the line is fixed. Open the named file, go to the named line, and correct the syntax; in this test a section header had lost its closing quote and bracket.

The fix as run: line 10 changed from [remote "origin to [remote "origin"], after which git status worked again. Use a plain text editor on .git\config; in this test git config --local --list stopped with the same error.

The error

> git status
fatal: bad config line 10 in file .git/config
exit=128
> git config --local --list
fatal: bad config line 10 in file .git/config
exit=128
> Get-Content .git\config
[core]
	repositoryformatversion = 0
...
[user]
	name = Lena Fischer
[remote "origin
	url = https://example.test/lena/app.git

Why it happens

The config file had been edited by hand: a [remote "origin section header was appended with the closing quote and bracket missing. Git reported the line number of that header, line 10, and the path of the file, and both git status and git config --local --list stopped with exit code 128 before doing anything else, so in this test the file was repaired as text, not through git config.

The message names the file it failed on, so read that part too: the path tells you which file to open. Here it was .git/config, the repository's own config, written with forward slashes even on Windows. The line number counts from the top of that file (line 10 of the eleven lines in the file), and in this test it pointed at the broken header itself rather than at the url line below it, so start at the exact line the message gives and look at the brackets and quotes first.

The fix

> Get-Content .git\config | Select-Object -Last 2
[remote "origin"]
	url = https://example.test/lena/app.git
> git status
On branch main

No commits yet

nothing to commit (create/copy files and use "git add" to track)
exit=0
> git config --local remote.origin.url
https://example.test/lena/app.git

With the header closed, git status ran and git config read the remote's URL from the repaired section. In the test the line was changed by a string replace in a script; on your machine, open the file in an editor and fix the line by hand. If you cannot see what is wrong with a line, compare it with a section Git wrote itself, such as [core] at the top of the same file.

How it was reproduced

Git for Windows 2.45.2.windows.1 in Windows PowerShell 5.1: git init of a throwaway repository, one git config user.name entry, then a broken [remote "origin header and a url line appended to .git\config with [System.IO.File]::AppendAllText. Only that repository's config was touched.

Frequently asked

How do I fix fatal: bad config line in file .git/config?
Open the file named in the message in a text editor, go to the line number it gives, and correct the syntax. In this test a section header missing its closing quote and bracket was the cause.
Can I fix bad config line with git config commands?
In this test git config --local --list stopped with the same fatal error, so the file was fixed as text instead.
What does a valid section header look like in .git/config?
A name in square brackets, with a subsection in double quotes, for example [remote "origin"]. Compare the broken line with sections Git wrote itself, such as [core].

More decoded errors in the Fixes category.