Tag Archives: error: could not lock config file Java/jdk1.7.0_71/.gitconfig: Permission denied

[Solved] Git Bash error: could not lock config file Java/jdk1.7.0_71/.gitconfig: Permission denied

 

Git is installed for the first time today. It appears when it is configured according to the tutorial

$ git config --global color.diff auto
error: could not lock config file C:/Program Files/Java/jdk1.7.0_71/.gitconfig: Permission denied

After several attempts, solution :
find git installation directory, set the properties of git-bash.exe, and tick “run this program as administrator” on the compatibility property page

The following is a record of the course at that time:

When I first met this problem, I guessed that git needed administrator permission, so I asked which git was, and I looked where git was

$ which git
/mingw64/bin/git

Then add administrator rights to the properties of/mingw64/bin/GIT. Exe. Naively, I thought it was solved in this way, but the result was:

$ git config --global color.diff auto
bash: /mingw64/bin/git: Permission denied

So I thought that the program that calls git.exe needs administrator permission. But who calls git.exe?Also try to modify the permissions of/CMD/git.exe,/bin/bash.exe,/bin/git.exe, and still report the same error

When there was no way out, I suddenly found git-bash.exe in the GIT root directory. As soon as I saw it, I modified the permissions of git-bash.exe and found that the problem was solved! After removing the previous redundant permissions, there is still no problem

It is concluded that just setting the permission of git-bash.exe is enough