Open rjmunro opened 9 years ago
Not really. Also, I'm not sure it's in GitX
scope to have that kind of customizability, because as far as I know, libgit2
won't support hooks in the traditional "shell script" sense.
Have you tried using #!/usr/bin/env bash
as your shebang line ? But I think you might lose git-specific environment variables though...
Are you sure you have your bash environment set up properly?
.bashrc vs .bash_profile
http://www.joshstaiger.org/archives/2005/07/bash_profile_vs.html The git hooks are not running in an interactive shell.
@hardkrash My bash environment is set up correctly, yes. The problem is that bash never runs if I log in to my Mac and start gitx from the GUI. This seems like the same problem atom has here: https://github.com/atom-community/linter/issues/726
The solution should be to put paths in /etc/paths
and /etc/paths.d/
rather than configuring bash profiles etc., but those paths are not making it to gitx in my setup.
For anyone else coming across this, fully closing gitx and relaunching it from the terminal with gitx .
while your PATH is set properly (e.g. to a virtualenv) seems to cause it to inherit that environment, letting pre-commit hooks run as they would if git were called from the command line!
Is there a way to specify the environment variables that hooks will be executed with? I have a hook that uses nodejs that is installed at
/usr/local/bin/node
, but the hook says the command node cannot be found. I have worked around it by manually adding a line:at the top of the bash hook script itself.