Repository navigation
Description
Describe the bug
On Windows systems with WSL installed, GitHub desktop will run pre-commit scripts on WSL instead of running them in PowerShell regardless of which shell the user has picked to use. This results in the scripts looking for windows locations that don't exist on WSL.
Version & OS
Version 2.9.0 on Windows 10 21H1 build 19043.1081 running with WSL 2 on Ubuntu 20.04
Steps to reproduce the behavior
- Make some changes to a file in a project with a pre-commit script (I'm using the npm package husky which installs these)
- Add a commit message and try to commit
- You should get the following error
Expected behavior
GitHub desktop runs the pre-commit scripts on windows PowerShell, just like git does (tested this)
Actual behavior
The scripts are run on WSL which causes errors
Screenshots

(this path is correct for my system but may be different on others)
Logs
This log has the error multiple times, which should help.
2021-07-03.desktop.production.log
Additional context
Got this error on the repositories discordjs/discord.js and discordjs/builders (forks of them) so you can try committing on these to see if you get the same errors. I also believe this issue should have relatively high priority since I am incapable of committing through my PC (unless I use git, which is more limited on some things and harder for me)
Yesterday we shipped GitHub Desktop 3.5.5-beta1 to our beta channel with improved support for hooks related to committing.
The support is experimental and currently limited to our beta channel. While we believe that this release resolved this issue we're looking for real-world feedback so if you have the ability we'd appreciate it if you could download our beta channel and give it a spin. Ensure the experimental hooks support it's enabled by going to Settings -> Git -> Hooks and making sure the "Load Git hook environment variables from shell" is ticked.
Activity
steveward commentedon Sep 9, 2021
@ImRodry thanks for reporting this. GitHub Desktop ships with an internal version of Git which we use for all actions inside the app. As such the environment within which your commit hooks execute will likely not exactly match that of your normal environment.
You can take a look at #9351 and see if the workaround in #9351 (comment) is applicable to your situation. One user also had success by changing the husky command from
"pre-commit": "lint-staged"to"pre-commit": "npx lint-staged".This comment and this comment also have some potential workarounds for this issue.
Let me know if any of that helps.
ImRodry commentedon Sep 9, 2021
@steveward thanks for the response. I tried all of the suggestions you linked (some didn't apply to my scenario though) and none worked nor did they produce a different kind of error. The error is still the same as the one I attached in the initial message :/
JosefBredereck commentedon Nov 12, 2021
I get a similar error described in #13307
But for me, it's bash that fails:
Additional Info: I have now installed node V14.17.1, and it is working without errors. This issue seems to be connected to the applied version.
nk-o commentedon Nov 17, 2021
@JosefBredereck same here, after updating node v14 to the latest v16 I see this error from Husky + Lint Staged:

zprjk commentedon Dec 10, 2021
Similar problem here also. Win10 + Husky v7 + Github Desktop
Not running through WSL but I have Git Bash installed.
cdaycmc commentedon Jan 4, 2022
I upgraded to Node v16 and husky stopped working with the same error as above. I then downgraded to v14 of Node and it worked again.
v16.13.1 x64 didn't work (latest LTS)
v14.18.2 x64 did work
[-]Desktop tries to run pre-commit scripts on WSL[/-][+]Desktop fails to run pre-commit hooks on node 16+[/+]CameronJThomas commentedon Jan 6, 2022
I had a parade of issues with Husky 7 and Node 16 on GitHub Desktop, which I resolved by:
C:\Program Files\Git\binto my system PATH.git config stash.usebuiltin falsein my repository directory.At last it is working. The fault seems to lie somewhere between Node 16, and Desktop insisting on using its built in version of Git. 🤷
Airkro commentedon Jan 7, 2022
Ugly but work:
vtabashniuk commentedon Jan 14, 2022
helped. Thanks
m-richards commentedon Jan 16, 2022
Have just run into the same underlying WSL on windows issue trying to use pre-commit (https://github.com/pre-commit/pre-commit), which generates this pre-commit hook after running
pre-commit install.INSTALL_PYTHONis generated based upon the environment pre-commit install is run in. But when github desktop runs this on wsl that path is invalid so the script fails.bschaeublin commentedon Jan 27, 2022
I also get:
To:
This is more like a heavy workaround and it gets reverted automatically after updateing I guess.
@steveward
It is really weird, that github desktop does not support pre-commit hooks, as it is an essential thing for a git client.
What could github desktop do, to support it? Use Powershell? Let the user configure an alternative git bash?
Revert "Upgrade package "husky""
manzoorwanijk commentedon Feb 4, 2022
Any update on this?
30 remaining items
1071125093 commentedon Apr 12, 2023
MARK
badJaguar commentedon May 16, 2023
@Puyodead1
Worked for me!
React 18+,
Vite 4.2.0,
yarn monorepo
mahsarajabpour commentedon Jun 11, 2023
This worked for me:
run this command
npx husky-inittypicode/husky#944 (comment)
Geczy commentedon Jan 6, 2024
slight optimizations, but the original answer helped
workflow: temporarily fix desktop/desktop#12562
workflow: temporarily fix desktop/desktop#12562
Remove buggy 'lint-staged'
shivam12323 commentedon Dec 25, 2024
just check if nvm is installed or not
nvm --version
if not than install
2nd also check it node-v also
smell-of-curry commentedon Jun 28, 2025
Still an issue, any update?
FYI, using
npm.cmd(appending.cmdto end of your command) will fix it (but might cause issues on UNIX-based machines)So the best fix is to add
C:\Program Files\Git\binto System Variables, ensuring you place it afterC:\Program Files\Git\cmd. But this will not fix npm commandsSo I ended up doing this:
Which will allow you to implement new commands very easy.
niik commentedon Jan 14, 2026
Yesterday we shipped GitHub Desktop 3.5.5-beta1 to our beta channel with improved support for hooks related to committing.
The support is experimental and currently limited to our beta channel. While we believe that this release resolved this issue we're looking for real-world feedback so if you have the ability we'd appreciate it if you could download our beta channel and give it a spin. Ensure the experimental hooks support it's enabled by going to Settings -> Git -> Hooks and making sure the "Load Git hook environment variables from shell" is ticked.
[newjersey/doula-pm#444] Remove the pre-push hook
[newjersey/doula-pm#444] Remove the pre-push hook
[newjersey/doula-pm#444] Remove the pre-push hook