Git post-receive hook package installation not running

I am having trouble running hook-post-receive as follows:

#!/bin/sh unset $(git rev-parse --local-env-vars) cd ~/commodity git pull origin master bundle install bundle exec rake assets:precompile thin restart 

I go from local to remote and I get this error:

 Counting objects: 5, done. Delta compression using up to 4 threads. Compressing objects: 100% (3/3), done. Writing objects: 100% (3/3), 319 bytes, done. Total 3 (delta 2), reused 0 (delta 0) remote: From /var/www/html/test remote: * branch master -> FETCH_HEAD remote: Updating a06129c..c3c3da3 remote: hooks/post-receive: line 19: bundle: command not found remote: hooks/post-receive: line 20: bundle: command not found remote: hooks/post-receive: line 21: thin: command not found error: cannot run hooks/post-receive: No such file or directory 

When I clone my repository on the server and click, the hook starts and everything is fine. Any ideas why pressing doesn't start the beam command when pressed from my local machine?

Thanks!

+6
source share
1 answer

Try adding this line to your hook after receiving (at least until your first bundle ... call bundle ... ):

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"

On Unix systems, rvm automatically adds this line to ~/.bash_profile . In any non-bash contexts (crontab, git hooks) you must add it manually.

+4
source

All Articles