I've been slowly going insane from a recurring permission error encountered when running any git command within any makefile:
for instance running make against:
a:
git --version
will result in:
make: git: Permission denied
make: *** [makefile:<line number>: <target>] Error 127
Observations:
Environment:
I use makefiles extensively at work and this problem has slowly become more and more frustrating. If anyone has any insights or suggestions on how to fix this issue it would be greatly appreciated. Thank you.
It would be really, really helpful if you provided the recipe you're trying to run that's giving the above error, or even the make output of the command that was invoked. Without that we can only guess, which is kind of a waste of everyone's time :)
My suspicion is this: you have a directory on your $PATH
which has a directory named git
in it, and this appears before /usr/bin
in your $PATH
.
There's a bug in GNU make 4.3 (actually the bug was in gnulib, which GNU make uses) which didn't correctly ignore directories when searching PATH
.
However, this cannot be the problem if your recipe invokes git
in a non-trivial way (as part of a shell script).
The fastest way to check this is just to add a semicolon to your command line; you didn't show us the entire recipe so we can't be sure but if you have:
foo:
git --version
try changing this to:
foo:
git --version;
and see if it works.