git post-receive hook没有运行bundle install [英] git post-receive hook not running bundle install

查看:380
本文介绍了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
undle bundle exec rake assets:precompile
瘦重启

我从本地推送到远程,并且出现此错误:

 计数对象:5,完成。 
使用多达4个线程的增量压缩。
压缩对象:100%(3/3),完成。
写入对象:完成100%(3/3),319字节。
合计3(增量2),重用0(增量0)
远程:从/ var / www / html / test
远程:*分支主机 - > FETCH_HEAD
remote:正在更新a06129c..c3c3da3
remote:hooks / post-receive:line 19:bundle:command not found
remote:hooks / post-receive:line 20:bundle:command找不到
remote:hooks / post-receive:line 21:thin:找不到命令
错误:无法运行hooks / post-receive:没有这样的文件或目录

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

谢谢!

bundle ... 调用之前):>解决方案



[[-s$ HOME / .rvm / scripts / rvm]]&&源代码$ HOME / .rvm / scripts / rvm



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


I am having trouble running the post-receive hook 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 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):

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

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

这篇关于git post-receive hook没有运行bundle install的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆