Issue
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
Getting Started Installing Git
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:
error: could not lock config file /etc/gitconfig: Permission denied
Solution
Files under /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
This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0