Git-Tower for Mac - how can i use --no-verify flag in each commit?

2.5k Views Asked by At

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.

4

There are 4 best solutions below

0
Jakub Mucha On BEST ANSWER

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.

0
Nora --Git Tower support 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.

0
mathieug 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"
1
Klaasvaak 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