git post-receive hook没有运行bundle install

我无法运行post-receive hook,如下所示:

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

我推从本地到远程,我得到这个错误:

 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 

当我在服务器上克隆我的资源库并推送时,钩子运行,一切都很好。 任何想法,为什么推从我的本地机器推不会触发捆绑命令?

谢谢!

Solutions Collecting From Web of "git post-receive hook没有运行bundle install"

尝试将这一行添加到您的post-receive钩子(至少在第一个bundle ...调用之前):

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

在Unix系统上,rvm自动将这一行添加到~/.bash_profile 。 在任何非bash上下文中(crontab,git钩子),你必须手动添加它。