New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong scriptPath
when installing husky through hook ran via git GUI
#606
Comments
Hi @giovannipiller, Thanks for the bug report. Could you try with |
After installing Looks like Failed hooks via GUIHere's the log during failed commit hooks via GUI:
Output of installation from terminalJust for completion.
|
Here's 3 workarounds when using GIT-Tower or any other GUI with 1. .husky.local (or ~/.huskyrc)Create a
Pros: it's versioned and shared with all your co-workers, if you use .husky.local Personally, this is my favorite solution. 2. GIT-Tower environment varsYou can create a PLIST XML file to let GIT-Tower know the value of environment variables. Pros: when using GIT-Tower, this config is shared across all projects on the machine 3. Permanently edit your PATHPermanently edit your path to include everything added from your Pros: system level, won't affect just GIT-Tower. |
@typicode I think it would be a good idea to have ex. We could have an error message, possibly with some instructions on how to fix it. I guess we'd have to change the |
Thanks for the feedback. Husky 5 will break if some command is not found 👍 |
Hi there! 😁
We have a hook that performs a
npm ci
(ornpm install
) if package-lock.json changes during a merge or checkout. This works flawlessly when we run git straight from the Terminal (ex.git checkout develop
), but has issues when the hook is triggered from a GUI.Interestingly, this issue doesn't happen on 2.7.0, but it does on pretty much any 3.x.
Looks like it could be related to the use of
git rev-parse
.git rev-parse --show-toplevel --git-common-dir
seems to produce different results:npm ci
via GUI:/Users/myuser/development/myproject/node_modules/husky
/Users/myuser/development/myproject/.git
npm ci
via Terminal:/Users/myuser/development/myproject
(same aspwd
)../../.git
This results in
.git/hooks/*
created with a wrongscriptPath
value when executed via GUI, which causes hooks to not be executed unless they're reinstalled via Terminal. See output below.Any idea on how we can workaround this issue?
From GUI (GIT-Tower)
As many Git GUI do, Git-Tower doesn't run in the same environment as the Terminal.
Debugger during husky installation
Hook result
Excerpt from
.git/hooks/pre-commit
❌ hooks are not executed
From terminal
Debugger during husky installation
Hook result
Excerpt from
.git/hooks/pre-commit
✅ hooks work as expected
System info
The text was updated successfully, but these errors were encountered: