Closed SetupCoding closed 4 months ago
Looks like the hook hangs in the endless recursion. Why do you think Fork is related?
When executing git push
manually in the command line, the hook executes correctly (as described in the "expected behavior" section).
If I push via Fork UI by pressing the "Push" button, the logs look as described above and even if I immediately quit Fork after that, it seems to continue with the recursion and still causes my MacBook to freeze and then shut down.
(It seems to keep spawning node processes in the background that consume the RAM eventually).
This is why I believe that it is Fork related.
Fork is not directly related. Most likely the problem is caused by different ENV
and $PATH
variable in particular in Fork and in your terminal.
To debug this, add echo $PATH
to your hook and compare results in Fork and in CLI.
You can make Fork inherit ENV
of the terminal by starting it from CLI using open -a Fork
command.
Yeah I tried open -a Fork
, but it still causes the infinite recursion without me being able to stop it (even from Mac Task-Manager).
Normal fork start:
/Applications/Fork.app/Contents/Resources/git-instance/libexec/git-core:/Applications/Fork.app/Contents/Resources/git-instance/git-lfs:/Applications/Fork.app/Contents/Resources/gitflow-avh:/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
Fork with open -a Fork
:
/Applications/Fork.app/Contents/Resources/git-instance/libexec/git-core:/Applications/Fork.app/Contents/Resources/git-instance/git-lfs:/Applications/Fork.app/Contents/Resources/gitflow-avh:/opt/homebrew/bin:/usr/local/bin:/Users/antonschmidt/.nvm/versions/node/v20.9.0/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin
Normal terminal $PATH
:
/Users/antonschmidt/.nvm/versions/node/v20.9.0/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin
Anything else I could try or compare?
The only difference I see is that Fork adds /opt/homebrew/bin:/usr/local/bin:/
with a higher priority than ~/.nvm
.
Do you have other node versions installed, other than nvm? Try to delete them.
I ran brew uninstall --force node
to make sure I had no other node version installed apart from nvm
.
I also double checked according to this guide and deleted all folders and files that are standalone node (non nvm).
Running open -a Fork
gave me the exact same $PATH
after doing so.
Same for the terminal $PATH
.
HOWEVER running open -a Fork
after removing some node leftovers did not result in an infinite recursion and did not crash my Mac 🎉 Instead it successfully executed the pre-push hook and pushed the changes. 🙌
One remaining issue: When opening Fork "the default way" (from the dock) and pushing, I get the following error:
Pushing to github.com:my-project/my-project.git
.husky/pre-push: line 2: npm: command not found
error: failed to push some refs to 'github.com:my-project/my-project.git
Is there some way to make Fork always inherit ENV
when starting from the dock?
Many thanks in advance!
Is there some way to make Fork always inherit
ENV
when starting from the dock?
No, I don't know a way to do that.
Alright!
My Apple M3 Pro MacBook with 36GB RAM crashed when using a husky pre-push hook. Husky version:
"husky": "^9.0.11",
Fork Version: 2.43.1The pre push hook executes
npm run lint -w packages/components
which lead to the following logs in Fork after I clicked push:and it kept on adding
"packages/components"
for a while until my mac warned me that I am running out of memory after which it crashed and rebooted.Expected behavior:
Any additional information I can provide?
Many thanks in advance!