I'm using MSYS2/git with a proper installation of git for windows SDK Install git inside MSYS2 proper
The git.exe is in /mingw64/bin directory (which is added to $PATH), but other packages that git needs (specifically like sh.exe and less.exe) are in /usr/bin directory which I don't want to put in $PATH to avoid polluting my environment with other executables like mkdir and dir,...
Currently, some git commands need those packages like git config -l which needs less and any git command that'll open the EDITOR will need sh.exe.
What I want to achieve is adding less and sh to the PATH without adding the whole directory.
I tried adding them using methods HERE and HERE. Most of them allowed me to use sh and less directly from the terminal, but none of them made the dependent git commands work.
For example, creating a symlink of less and sh in the /mingw64/bin directory will make the command prompt recognize these executables, but using git config -l will give no output at all unless the directory of less was added to $PATH.
However, other methods (creating scripts and shortcuts,..) will make git complain "Unable to spawn sh/less", altgough cmd and powershell would recognize less and sh.
Why would the executable work from the terminal, but not with git? Especially the symlink case where git didn't complain about missing EXEs but still didn't function properly?