We are using husky pre-commit hooks and i cannot commit with tower ever since. I use the CLI for my commits now but i want to be able to use Git Tower as well.
Any users out there know a quick fix? Thank you.
On
In general, Desktop Apps don't have the Shell environment available. In order to enable you to use your commit hook with the bundled Git binary, you'll need to set up an environment.plist file manually.
Here is a detailed guide for this in the Tower Help guide: https://www.git-tower.com/help/mac/faq-and-tips/faq/hook-scripts
Please feel free to reach out to us via https://www.git-tower.com/support/contact if you need further assistance.
On
I have found this useful article: https://dev.to/studiospindle/using-husky-s-pre-commit-hook-with-a-gui-21ch
You can create a file ~/.huskyrc containing:
PATH="/usr/local/bin:$PATH"
or if you use nvm:
PATH="/usr/local/bin:$PATH"
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
On
Instead of disabling husky you can also make it work with Tower. It took me a while to figure this out. In MacOS Tower (and other GUI apps) does not run in the same environment as your cli does, in my case zsh.
I added the following to the ~/.huskyrc file to make this work:
#!/usr/bin/env sh
source ~/.zshrc
To disable hooks introduced by
huskyin frontend project, you can:Create
environment.plistfile in~/Library/Application Support/com.fournova.Tower3/with following content:That's it. Next time if you try to push something, hooks introduced by
huskywill be disabled.Note: you can also use this flag with CLI like this:
HUSKY_SKIP_HOOKS=1 git <command> ...I've also wrote a blog post about it.