While trying to set up Git with my GitHub account the following error keeps persisting whenever I try to do a global config.
It works fine for repositories, but the global doesn't work.
Here's how it shows:
$ git config --global user.name "username"
error: could not lock config file C:/Path/to/.gitconfig: File exists
I'm using Git 2.21.0 on Windows 10 Pro.
gitconfig located in the user's home folder (C:\Users\git user) Local Git configuration: File named config in the . git folder of the local repo.
Try opening it and see do this file look like this. Try setting global config through command line by- git config --global user. email "[email protected]" It automatically set the . gitconfig in the directory it needed.
Since you're on Windows 10, it could be an issue if your .gitconfig is located at C:. If that's the case, try running your git bash with Administrator privileges (right-click on your executable, select More > run as Administrator) and see if that works. You need administrator privileges to work on files at the root of C:. That worked for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With