typicode / husky

Git hooks made easy šŸ¶ woof!
https://typicode.github.io/husky
MIT License
31.68k stars 996 forks source link

cannot pre-commit #1403

Open draylegend opened 2 months ago

draylegend commented 2 months ago
husky 9.0.11
node 20.11.1
npm 10.2.4
nx 18.1.0
WSL version: 2.0.14.0
Kernel version: 5.15.133.1-1
WSLg version: 1.0.59
MSRDC version: 1.2.4677
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.22631.3235
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 12 (bookworm)
Release:        12
Codename:       bookworm
#.husky/pre-commit
git -v

running git commit -m "feat(lib): init" throws the error:

unknown option: -v
usage: git [-v | --version] [-h | --help] [-C <path>] [-c <name>=<value>]
           [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
           [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--bare]
           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
           [--super-prefix=<path>] [--config-env=<name>=<envvar>]
           <command> [<args>]
husky - pre-commit script failed (code 129)

BTW. the latest git version is 2.44.0, not 2.9.* as mentioned in the docs

I did also install 2.44.0 from source, same error.

typicode commented 2 months ago

I don't know why it doesn't work :thinking: I'm getting this:

$ echo 'git -v' > .husky/pre-commit
$ git commit -m foo
git version 2.44.0
draylegend commented 2 months ago

forgot to mention versions of WSL and debian

typicode commented 2 months ago

šŸ¤” honestly don't know, try echo to create the file to get the code editor out of the picture?

draylegend commented 2 months ago

OMG dat CRLF lol. Can anyone explain it to me why husky accepts only LF and not both?

@typicode u r AWESOME! thanks!

I'm using phpstorm and somehow it creates files with CRLF šŸ˜’