permission denied trying to set global git config

Viewed 708

in visual code terminal, I am trying to create user account with the command git config --global user.name "Tari shah", but I am keep getting the error

error: could not lock config file C:/WINDOWS/system32/config/systemprofile/.gitconfig: Permission denied".

please let me know how to resolve this issue.

1 Answers

That looks like VSCode was launch with the System account or Administrator account, but not your own Windows account.

Try the same command in a regular CMD session, opened regularely (not as admin): it should write in %USERPROFILE%\.gitconfig.
You can see that with (using Git 2.27):

git config -l --show-origin --show-scope

So try and re-launch your VSCode from your Windows account.

Related