5

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.

Divide by Zero
  • 1,343
  • 1
  • 14
  • 37

3 Answers3

5

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.

5

To disable hooks introduced by husky in frontend project, you can:

Create environment.plist file in ~/Library/Application Support/com.fournova.Tower3/ with following content:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
    <key>HUSKY_SKIP_HOOKS</key>
        <integer>1</integer>
  </dict>
</plist>

That's it. Next time if you try to push something, hooks introduced by husky will 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.

Jakub Mucha
  • 1,342
  • 1
  • 13
  • 18
0

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"
mathieug
  • 901
  • 1
  • 11
  • 24