简体   繁体   English

git post-receive hook没有运行bundle install

[英]git post-receive hook not running bundle install

I am having trouble running the post-receive hook as follows: 我无法运行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

I am pushing from local to remote and I am getting 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 push, the hook runs and everything is great. 当我在服务器上克隆我的存储库并推送时,钩子运行,一切都很好。 Any ideas why the push wont trigger the bundle commands when pushing from my local machine? 任何想法为什么推送从我的本地机器推送时不会触发捆绑命令?

Thanks! 谢谢!

Try to add this line to your post-receive hook (at least before your first bundle ... call): 尝试将此行添加到您的收件后挂钩(至少在您的第一个bundle ...呼叫之前):

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

On Unix systems, rvm adds this line automatically to the ~/.bash_profile . 在Unix系统上,rvm会自动将此行添加到~/.bash_profile In any none-bash contexts (crontab, git hooks) you have to add it manually. 在任何非bash上下文(crontab,git hooks)中,你必须手动添加它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM