In my case, the pre-commit file was a php file and I hadn't php installed. I was getting this:
fatal: cannot exec 'pre-commit': No such file or directory
And installing php-cli with
sudo apt install php-cli
Solved the problem.