I am relatively new to the Ubuntu OS and Git.
I have installed Git on Ubuntu 20.04 by following the instruction mentioned in the following link
As mention in the next step that there are three levels of Git Configuration
- System Level Configuration – which applies to every user and all their repositories on the system
- Global Level Configuration – which applies to the current user and all the their repositories on the system
- Local Level Configuration – which applies to the specific repository you are working with
I was able to change the global settings of the git by using the –global option, and also change the local setting of the git by using the –local option. But when I tried to change the setting of the git on system level using –system option, I encoutered the following error by the running the command
git config --system user.name "My Name"
error: could not lock config file /etc/gitconfig: Permission denied
/etc/ belong to root and must be edited with root privileges:
sudo git config --system user.name "My Name"
But you’re trying to set you personal configuration in the system config. My advice is: don’t do that, use your global user config:
git config --global user.name "My Name"
Answered By – phd