2012-11-14 37 views
6

我無法運行後收到鉤如下:混帳後收到鉤不運行包安裝

#!/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 

當我在服務器上克隆我的存儲庫並推送時,鉤子運行並且一切都很好。 任何想法爲什麼推從我的本地機器推動時不會觸發捆綁命令?

謝謝!

+0

在服務器上克隆時,您使用的是文件系統還是SSH路徑?這可能與您的SSH用戶獲得$ PATH有關。也許可以在'post-receive'中嘗試'echo $ PATH'並將它與shell中看到的'echo $ PATH'進行比較。 –

+0

嗨,本,我克隆的文件路徑,而不是SSH。我嘗試使用SSH進行克隆,現在它在服務器上斷開。這裏是我的$ PATH:/ usr/libexec/git-core:/ usr/local/sbin:/ usr/local/bin:/ sbin:/ bin:/ usr/sbin:/ usr/bin – pudding

+0

你的'bundle'和那個路徑中的「瘦」二進制文件?在SSH路徑中切換到用戶,例如對於git @ hostname:repo.git,執行'su git'。該用戶可以看到'bundle'和'thin'命令嗎?當你嘗試運行它們時會發生什麼?如果需要的話,修改後接收腳本中的'PATH',以便可以找到命令,例如'PATH = $ PATH:/ path/to/bundle' –

回答

4

嘗試添加此行到您的文章-receive掛鉤(至少在你的第一個電話bundle ...):

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

在Unix系統中,RVM自動添加此行到~/.bash_profile。在任何非bash上下文中(crontab,git鉤子),你必須手動添加它。

+2

remote:hooks/post-receive:2:[[:not found – jakxnz

+0

source command not found – juanpastas

+1

這也許是這個http://stackoverflow.com/a/5829823/1197775 – juanpastas