-al for -1 -v line-endings crlf lf -d

Source

  • ensure that the hooks are executable and contain Linux line endings (LF instead of CRLF)
ls -al .git/hooks/
for f in $(ls -1 .git/hooks/* | grep -v '.sample'); do cat -v ${f}; done

(look for ^M sequences in the cat output this means that the file has Windows CRLF line endings)

  • to convert all hooks
for f in $(ls -1 .git/hooks/* | grep -v '.sample'); do cat -v ${f} | tr -d '\r' > ${f}.tmp && mv ${f}.tmp ${f}; done

(see ls with path)