error: cannot spawn .git/hooks/pre-commit: No such file or directory on Windows

See original GitHub issue

Hi, I’m using a windows machine. When I run standard-version I get: error: cannot spawn .git/hooks/pre-commit: No such file or directory. .git/hooks/pre-commit exists and it works if I run the standard-version git commit command manually. In my project I use Husky which makes my pre-commit hook look like this:

#!/bin/sh
# husky
# v1.0.0-rc.2 win32

export HUSKY_GIT_PARAMS="$*"
node ./node_modules/husky/lib/runner/bin `basename "$0"`

Thanks.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:19
  • Comments:6

github_iconTop GitHub Comments

150reactions
someoneinatreecommented, Sep 26, 2018

I got this issue and solved it by putting #!/bin/sh as the first line of the pre-commit file. YMMV

0reactions
initializationcommented, Nov 6, 2022

I got this issue and solved it by putting #!/bin/sh as the first line of the pre-commit file. YMMV

the solution is very good

Read more comments on GitHub >

github_iconTop Results From Across the Web

Share - Stack Overflow
I'm using SourceTree and git LFS and had a similar issue: cannot spawn .git/hooks/pre-push . The fix was to delete the pre-push file...
Read more >
Error cannot spawn git hooks pre push No error
Go to.git/hooks directory and remove pre-commit file, as its trying to reference to node_modules/pre-commit/hook. It should resolve it.
Read more >
Thursday, August 22, 2019 - Tips, Tricks and Tools
Git error: cannot spawn .git/hooks/post-commit: No such file or directory. This error could happen when on the Windows.
Read more >
error: cannot spawn git: No such file or directory
> repository it must blow up some internal command line limits on cygwin. Good point, but are you sure you're using Git for...
Read more >
Push stopped working / hooks/pre-receive cannot be spawn
Solved it myself: Git installation was broken. Uninstalling and installing git to a different path solved the issue.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found