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
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\binas the value.
Click the “Move Up” button so it is placed before the
Save and apply.
Restart GitHub Desktop and try again.