Skip to content
Advertisement

bundle install not running from my post-update hook

I’ve setup a post-update hook for my project. I have a bare repository (/var/git/myproject) which I push to, and a live repository (/var/www/myproject) where my app is running. I also included bundle install and bundle exec rake db:migrate to install gems and update db.

Below is my post-update hook

JavaScript

When I push my changes though I get the following message (notice the “bundle command not found” error):

JavaScript

Why is bundle not running? I cd to the live app directory in the script. When I’m in terminal myself and I cd to the live directory and run bundle install it works so bundle is there.

Advertisement

Answer

Your hook shell ins’t the same than the one you logged in (and which has the proper PATH)

You can try using at the beginning your your hook script:

JavaScript

(See this answer

The -l parameter executes the command in a login shell, which means that it inherits your path and other settings from your shell profile.

)

Or you can make sure your script gets the same environment than your current session, by adding in the first lines of your hook:

JavaScript

Or (final alternative) you can add (before calling bundle) (for a single-user rvm installation)

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement