I'm getting the following error in Visual Studio Code on Windows when I try to commit code:
2022-12-19 07:17:00.902 [info] Author identity unknown
*** Please tell me who you are.
Run
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.
fatal: no email was given and auto-detection is disabled
So I run this command:
PS E:\path\to\repo> git config --global user.email "[email protected]"
error: could not lock config file %HOMEDRIVE%%HOMEPATH%/.gitconfig: No such file or directory
I tried the same from Git-Bash with the same result:
johndoh@myhost MINGW64 /
$ git config --global user.email "[email protected]"
error: could not lock config file C:/Program Files/Git/%HOMEDRIVE%%HOMEPATH%/.gitconfig: No such file or directory
I installed git via the Visual Studio Installer:
C:\Users\johndoh>which git
C:/Program Files/Git/cmd/git.exe
C:\Users\johndoh>git --version
git version 2.38.1.windows.1
How do am I supposed to set this up for git on Windows with Visual Studio code? It seems like others may have run into this issue but it went away for them after they logged out and then back in again. Some of the other related Stack Overflow questions are: