You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Git pre-commit hook fails to run because of "No such file or directory" #12586
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.
@saschanaz thanks for the report. I tested this out in a Windows VM and was unable to reproduce this, so my guess is it's something specific to your environment. Can you try launching GitHub Desktop via the command line using the github command and see if that resolves this issue?
Symlinks was an idea.
I tried changing npm to npm.cmd (supposing you are on Windows) and got it working finally.
Don't know why but it works. But the problem is that pre-commit hook will not be cross-platform anymore
Does it work for you too?
Reacted by Paolo, AndyCrowley, NoobGPT, Oscar Andersson, Nathaniel Turner, Darren Thammavong and Natan Maia
Reacted by Andre Vincent Boivin, NoobGPT, Darren Thammavong and Natan Maia
Reacted by tomiGoljevscek, Paolo, Yahia Badr, Andre Vincent Boivin, NoobGPT, Darren Thammavong and Natan Maia
Insert git bin to PATH and put it before "%SystemRoot%\system32".
It works for me. It looks like Github Desktop used the wrong bash command which was provided by wsl.
Reacted by Mahmoud, PoteXB, Wellington Luiz Benedito Ostemberg, Bryan Field, Kelly Badger, Caesar, Michael Winkworth, Christopher Satchell, Tilman, André Pichardo and 15 more
Reacted by Bryan Field, Tilman, Luiz Augusto Silveira, Alejandro Mora and Darren Thammavong
Reacted by Bryan Field, Tilman, André Pichardo, MrrrLuiigii, Edgar Reyes, andrey-devgut, lars-devs, Alejandro Mora and Darren Thammavong
Reacted by Bryan Field, Piyush Aggarwal, Tilman, Edgar Reyes, andrey-devgut, Alejandro Mora and Darren Thammavong
2 years later, the same problem is happening. And updating the PATH doesn't fix it
The weird thing is, I just recently set up husky, ran into this issue, got it fixed by adding C: \Program Files\Git\bin to PATH until it broke on me again just a few days ago. I obviously did not change the PATH.
Maybe a newer version of GitHub Desktop broke things? (I'm currently on version 3.4.0 (x64)) It looks like the Windows PATH is not respected at all, as the error message I'm getting from husky looks like it's using MinGW:
.husky/commit-msg: line 4: npx.cmd: command not found
husky - commit-msg script failed (code 127)
husky - command not found in PATH=/mingw64/libexec/git-core:/mingw64/bin:/usr/bin:/c/Users/[my username]/bin:/mingw64/bin:/mingw64/usr/bin:undefined
Github desktop formats files after committting precommit
I am facing an issue where precommit format command works after committing the files. I mean the files are getting formatted only after committing the files. So I need to commit 2 times it seems...
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 Jul 27, 2021
@saschanaz thanks for the report. I tested this out in a Windows VM and was unable to reproduce this, so my guess is it's something specific to your environment. Can you try launching GitHub Desktop via the command line using the
githubcommand and see if that resolves this issue?saschanaz commentedon Jul 27, 2021
No, that does not solve the issue, the same message opens when committing anything.
ruggi99 commentedon Aug 3, 2021
@saschanaz Have you installed a node version manager in your environment?
I have the same issue and I'm trying to tackle it down
saschanaz commentedon Aug 3, 2021
No, but winget should probably work for that purpose I guess.
ruggi99 commentedon Aug 3, 2021
Nevermind.
I have the same issue, like already reported in #11603
saschanaz commentedon Aug 3, 2021
I don't think it's the same issue if your issue has symlink involved.
ruggi99 commentedon Aug 3, 2021
Yeah could be, or could be related for some reason
ruggi99 commentedon Aug 4, 2021
Symlinks was an idea.
I tried changing
npmtonpm.cmd(supposing you are on Windows) and got it working finally.Don't know why but it works. But the problem is that pre-commit hook will not be cross-platform anymore
Does it work for you too?
tomiGoljevscek commentedon Nov 17, 2021
This worked for me, thank you so much!
Airkro commentedon Jan 7, 2022
I think this is the same problem as #12562.
Wangyaqi commentedon Aug 23, 2022
It works for me. It looks like Github Desktop used the wrong bash command which was provided by wsl.
WellingtonOstemberg commentedon Nov 8, 2022
Solved my problem!
Finally
murugan1993 commentedon May 8, 2023
missing Change-Id in commit message footer this my error what to do can you explain
rdrinovec commentedon Jul 5, 2023
Does not work for me 😢
lucasnguyen3979 commentedon Nov 22, 2023
At first it didn't work for me, but then I added
C:\Program Files\Git\bintoPathfor both variable types: User and System, and it worked.TheMikeyRoss commentedon Jun 3, 2024
2 years later, the same problem is happening. And updating the PATH doesn't fix it
rmckr commentedon Jun 4, 2024
The weird thing is, I just recently set up husky, ran into this issue, got it fixed by adding
C: \Program Files\Git\bintoPATHuntil it broke on me again just a few days ago. I obviously did not change thePATH.Maybe a newer version of GitHub Desktop broke things? (I'm currently on version
3.4.0 (x64)) It looks like the WindowsPATHis not respected at all, as the error message I'm getting from husky looks like it's using MinGW:TheMikeyRoss commentedon Jun 4, 2024
@MeridianGH apparently something changed in Github Desktop in v3.4.0 that cause git hooks issues. It's being tracked in #18739
rmckr commentedon Jun 4, 2024
Thanks a lot, that is definitely the problem. I will hook into that issue then.
R-Mohammed-Hasan commentedon Jun 6, 2024
Github desktop formats files after committting precommit
I am facing an issue where precommit format command works after committing the files. I mean the files are getting formatted only after committing the files. So I need to commit 2 times it seems...
jflemingframe commentedon Jul 3, 2024
for me C:\ProgramData\nvm was in my PATH, and messed this up.
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