Fix: error: could not lock config file /etc/gitconfig: Permission denied


error- could not lock config file :etc:gitconfig- Permission denied
myrepo$ git config --system core.editor "nano -w"

error: could not lock config file /etc/gitconfig: Permission denied

If you are trying to add or edit a system configuration file you will get a Permission denied error because you need special privileges to access it.

Fix:

For the above example, it is better to set the core.editor at the user level using the --global configuration.

If you really want to set a property at the system level make use of sudo

sudo git config --system core.editor "nano -w"

Again you should have special privileges to do so, if not you will get sudoers error.

[sudo] password for user1: 
user1 is not in the sudoers file.  This incident will be reported.
-


Have Questions? Post them here!


Top Hashtags: