Skip to content

Instantly share code, notes, and snippets.

@dsmith73
Last active November 22, 2023 06:51
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
@dsmith73
Copy link
Author

dsmith73 commented Oct 23, 2023

Are you trying to use git with PowerShell or with Linux on WSL?

My setup is:
Win11 > WSL > Ununtu

Then I installed VS Code and finished setting everything up through Terminal.
So, for me, git is installed on Ubuntu, in WSL, not with PowerShell

@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.

@XzavierBauch
Copy link

XzavierBauch commented Nov 17, 2023

It seems you've handled it effectively. The initial steps of removing the Git directory and initializing a new repository are standard procedures. If any future issues arise, reviewing and modifying the .git/config file, as you described, can be a helpful troubleshooting step. My academic journey took a turn for the better when I discovered this https://domypaper.com/ professional writing service paper writers for hire Hiring the best paper writer from here was a decision that aligned with my pursuit of excellence. The paper delivered was more than just a document – it was a testament to the dedication and expertise of the writer. Trusting this service with my writing tasks has been a transformative experience, and if you're seeking a partner in your academic success, hiring the best paper writer here is the way to go.

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