Skip to content

Instantly share code, notes, and snippets.

@dsmith73
Last active October 21, 2024 16:56
Show Gist options
  • Save dsmith73/cc22031410d6660fd6e999608bb9be91 to your computer and use it in GitHub Desktop.
Save dsmith73/cc22031410d6660fd6e999608bb9be91 to your computer and use it in GitHub Desktop.
fatal: bad config line 1 in file .git/config

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

When I receive this error, the fix is to:

rm -rf .git

Then, I can git init again, with a clean initialization, and it works...


If the solution above doesn't work

Another solution that I found for this is:

  • open .git/config file
  • clear all the NULL values in the file
  • save and close the file
  • git add .

#dsmith73
github.com/dsmith73
@saimani1205
Copy link

saimani1205 commented Oct 24, 2023 via email

@dsmith73
Copy link
Author

Unfortunately, I can't assist you much with Git and PowerShell.

But it does look like your potential issue is identified inside your error message

warning: adding embedded git repository: .vscode
hint: You've added another git repository inside your current repository.
hint: Clones of the outer repository will not contain the contents of
hint: the embedded repository and will not know how to obtain it.
hint: If you meant to add a submodule, use:
hint:
hint: git submodule add .vscode
hint:
hint: If you added this path by mistake, you can remove it from the
hint: index with:
hint:
hint: git rm --cached .vscode
hint:
hint: See "git help submodule" for more information.

and, it tells you where to go to figure out how to fix it.

@Sankaranarayanan-vk
Copy link

Thanks, it helped. 🙏

@mhotep
Copy link

mhotep commented Sep 21, 2024

It works. Thank you. Nulls were there, but not there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment