Problem
When trying to commit in GitHub Desktop (Windows environment) to a repository that runs a Husky pre-commit hook, I got the following error message:
/usr/bin/env: ‘bash’: No such file or directory husky - pre-commit hook exited with code 127
Solution
I found this solution in a discussion on GitHub and it worked for me.
Here’s what I did to solve it:
Open Environment Variables by typing “Edit the system environment variables” in the Windows search bar.
Click the “Environment Variables…” button.
Under the “System variables” section, edit “Path”.
“New” -> set
C:\Program Files\Git\bin
as the value.Click the “Move Up” button so it is placed before the
%SystemRoot%\system32
line.Save and apply.
Restart GitHub Desktop and try again.