I was trying to set up some git aliases by adding these lines to my ~/.gitconfig
file:
[alias]
st = status
ci = commit
br = branch
I had this problem too but with a subtly different cause:
In my case the path contained an entry that was a file rather than a directory. The permissions on the file itself and its directory were fine. When a new terminal was loaded the file could be run from anywhere. However, git gave an identical error message.
So as well as looking for folders on the path with incorrect permissions I suggest anyone else with this problem also checks that the path points only to folders and not to files.