Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git config command showing permission denied

I'm new to Git and repeatedly getting the following error.

When I type the command git config --global color.ui auto I get the error:

error: could not lock config file C:/Program Files/Java/jdk1.8.0_101/bin/.gitconfig: Permission denied

I have been getting the same permission denied error for other commands as well. I don't know if there is any problem with the path.

like image 271
Dev Sharma Avatar asked Oct 25 '25 08:10

Dev Sharma


2 Answers

I was facing permission denied for git config --global user.name command from Git bash in Windows.

I ran the Git bash with Administrator privileges and was able to resolve the error.

Note: I also got the same error from Intellij trying to commit changes; that too got resolved after running Intellij in Admin mode.

like image 75
ron_coder Avatar answered Oct 27 '25 23:10

ron_coder


HOME should not be set to the JDK bin folder, but to your %USERPROFILE%.

Do check in a CMD session the value of your account:

set USER

You should see your username and USERPROFILE folder.

Then try the same git config command, in that CMD session, setting HOME first:

set HOME=%USERPROFILE%
like image 38
VonC Avatar answered Oct 27 '25 23:10

VonC