Reputation: 928
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
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
Upvotes: 12
Views: 61555
Reputation: 1560
In most cases, you might have installed git using sudo permissions, in other words as a root user. So .git directory is owned by root user
You can change the ownership to your user like
sudo chown -R bitnami:daemon .git/
Once .git
is owned by your user then you have all the permissions to config git using git config comands
.
Upvotes: 0
Reputation: 95119
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"
Upvotes: 14