Command Line Environment
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)
To provide you with a configurable environment, Tower supports defining environment variables in a custom file.
To make use of this, create a PLIST XML formatted file named
A sample to define your path could look like this:
<?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>PATH</key> <string>/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin</string> </dict> </plist>
You can add additional key-value pairs as needed.
If your hook script needs some variable to work properly, you can introduce it like this in the
<dict> ... <key>YOUR_VARIABLE</key> <string>YOUR_VALUE</string> </dict>
In case you're using a special authentication mechanism, like a smartcard (e.g. Yubikey), you can set this up here too. This should be similar to:
<dict> ... <key>SSH_AUTH_SOCK</key> <string>/Users/michael/.gnupg/S.gpg-agent.ssh</string> </dict>
You can either use a text editor to create a Property List or Xcode, which provides a Property List Editor.
Please note that environment variables like
$HOME aren't supported in the
environment.plist. Also note that using relative paths might cause problems, which is why you should consider using absolute paths.