In my case, I had the error (error: cannot spawn .git/hooks/pre-commit: No such file or directory) because my pre-commit script file was encoded in UTF-8 with BOM.
Changing the encoding to plain UTF-8 fixed it!
Hopefully that will save a headache to some people ^^