私はgit post-receiveフックを使ってssh経由でデプロイするレールサイトを持っています。サーバーにsshでバンドルをインストールすると、指定された2.2.2のRubyバージョンで正しく動作します。それはruby1を指している理由Rubyの間違ったバージョンで実行しようとしているバンドル
hooks/post-receive: /usr/local/bin/bundle: /usr/bin/ruby1.9.1: bad interpreter: No such file or directory
私は私の人生のために見つけることができません:私は私のローカルマシンからサーバーにプッシュし、それは「コマンドをインストールするバンドル」当たったときしかし、私は次の取得します.9.1。このディレクトリは存在しません。そのディレクトリにruby2.3のディレクトリがありますが、正しいディレクトリであるruby2.2.2はありません。何かがかなり汚いですが、私はそれを修正する方法を理解することはできません。誰もこのようなものを見た?
UPDATE:ここでは私のポスト受けるフックは
#!/bin/bash
GIT_DIR=/home/deploy/www_production
WORK_TREE=/home/deploy/www
export MGOTS_DATABASE_USER='user'
export MGOTS_DATABASE_PASSWORD='pass'
export RAILS_ENV="production"
. ~/.bash_profile
while read oldrev newrev ref
do
if [[ $ref = refs/heads/master ]];
then
echo "Master ref received. Deploying master branch to production..."
mkdir -p $WORK_TREE
git --work-tree=$WORK_TREE --git-dir=$GIT_DIR checkout -f
mkdir -p $WORK_TREE/shared/pids $WORK_TREE/shared/sockets $WORK_TREE/shared/log
# start deploy tasks
cd $WORK_TREE
bundle install
rake db:create
rake db:migrate
rake assets:precompile
rake requests:cleanup
sudo restart puma-manager
sudo service nginx restart
# end deploy tasks
echo "Git hooks deploy complete"
else
echo "Ref $ref successfully received. Doing nothing: only the master branch may be deployed on this server."
fi
done
がUPDATE ...下記の要求に従って、次のとおりです。明確にするために、答えを見つけるための正しい場所に対する答えのポイントとして、それを正確に述べていない、私はここに私の更新されたフックファイルを投稿しています。あなたはこれと上記の違いを見ることができます。それが問題を解決したものです。 rvmディレクトリへのパスは、次のコマンドを入力することで確認できます:which rvm - あなたが指し示したいものです。
#!/bin/bash
GIT_DIR=/home/deploy/www_production
WORK_TREE=/home/deploy/www
export MGOTS_DATABASE_USER='user'
export MGOTS_DATABASE_PASSWORD='pass'
export RAILS_ENV="production"
export RUBYGEMS_GEMDEPS="/home/deploy/.rvm/[email protected]/gems"
. ~/.bash_profile
[[ -s "/usr/share/rvm/bin/rvm" ]] && source "/usr/share/rvm/bin/rvm"
while read oldrev newrev ref
do
if [[ $ref = refs/heads/master ]];
then
echo "Master ref received. Deploying master branch to production..."
mkdir -p $WORK_TREE
git --work-tree=$WORK_TREE --git-dir=$GIT_DIR checkout -f
mkdir -p $WORK_TREE/shared/pids $WORK_TREE/shared/sockets $WORK_TREE/shared/log
# start deploy tasks
cd $WORK_TREE
bundle install
rake db:create
rake db:migrate
rake assets:precompile
rake requests:cleanup
sudo restart puma-manager
sudo service nginx restart
# end deploy tasks
echo "Git hooks deploy complete"
else
echo "Ref $ref successfully received. Doing nothing: only the master branch may be deployed on this server."
fi
done
gemfileでrubyのバージョンを指定していますか?あなたのgemfile ruby "2.2.2"に入れていない場合 –
私のgemfileのオープンは次の通りです:source 'https://rubygems.org' ruby "2.2.2" – unclesol
あなたのサーバにはruby 2.2.2がインストールされていますか? –