Hook scripts

Yes, hook scripts are respected by Tower. However, there are a few things to consider:

When you run Git from the command line, it runs in the environment as set up by your Shell. GUI OS X apps, however, have no knowledge about your shell - and the PATH environment can be changed in many different places. The actual environment they run in even varies depending on how the application has been started:

  • From Spotlight
  • From Finder
  • From the Dock
  • From the Terminal with the open command (or our CLI Tool)

The important question is: Do your hook scripts rely on the existence (or on specific values) of shell environment variables that are created/modified in your shell profile (like extending "PATH" by a non-standard-path (e.g. '~/bin')?

In that case, you have two possible ways to set up your required environment:

  • Set it up in the hook script itself. Please keep in mind things like modifying "PATH" should not be done in your shell profile, as the hook script is called from the Tower process environment which is not running in a shell environment (hence your shell profile is not loaded).
  • Set it up globally in Tower by using our environment.plist.

Also note that if your hook script prints out error messages and you would like them to be displayed in Tower, you have to make sure the error message is printed to STDERR:
     echo "Error!" >&2

Interactive scripts that require user input as part of the script are currently not supported in Tower.