I'm getting this error when trying to set the global config:
$ git config --global user.name "Your Name Here" error: could not lock config file /pathto/file/.gitconfig: No such file or directory
and the file .gitconfig is already exists, anyone have any ideas??
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.
git/config file in each repository is used to store the configuration for that repository, and $HOME/. gitconfig is used to store a per-user configuration as fallback values for the . git/config file. The file /etc/gitconfig can be used to store a system-wide default configuration.
The global git config is simply a text file, so it can be edited with whatever text editor you choose. Open, edit global git config, save and close, and the changes will take effect the next time you issue a git command. It's that easy.
A bit like in "Trouble setting up Tower with my GitHub Account - error: could not lock config file", check how that ~/.gitconfig
file has been created.
Ie: with which rights associated to it?
Make also sure your $HOME
variable is correctly set when you are executing the git config --global
command.
Check if you have a .git directory in your home folder and if you don't:
mkdir ~/.git
Solved the problem in my case.
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