Is there something different about the environment that a Git Hook SSHs into, compared to one that you SSH into manually? I'm trying to run Middleman as part of a post-receive hook, and can't get it to work properly. Even after the script runs Bundler, which should ensure that Middleman and any other gems are installed, the script can't find any of the gems that were just installed, and the rest of the post-receive hook never gets executed. If I SSH into the server and run Middleman from there, there are no issues. I already have the post-receive hook running source ~/.bash_profile
, so I figured that all the paths for RVM should be getting loaded properly, but I just can't get it all to work. Any tips on working with git hooks would be greatly appreciated!
Asked
Active
Viewed 87 times
1

Alex LaFroscia
- 961
- 1
- 8
- 24
-
You probably need to unset `GIT_DIR` in the environment before running various commands. Also see my list of [three common stumbling blocks](http://stackoverflow.com/a/18726025/1256452) for pre- and post-receive and update hooks. – torek Jan 14 '14 at 08:43
1 Answers
1
Just a note for anyone else running into issues with Gems and post-receive: I was installing the gems with 'sudo' but then trying to use them without it. Installing without sudo fixed the issue.

Alex LaFroscia
- 961
- 1
- 8
- 24