複数の git ユーザーでプロジェクトをデプロイするように Capistrano をセットアップしようとしています。私が働いている場所には、「git」のような一般的な git ユーザーがいません (そして、持ちたくありません)。したがって、デプロイ構成は「cap deploy」を実行するユーザーに関連しています。
config.rb ファイルでわかるように:
set :application, "mywebsite"
set :repository, "ssh://#{scm_user}@myserver.com/repo.git"
set :scm, :git
set :scm_verbose, true
set :deploy_via, :remote_cache
set :git_enable_submodules, 1
開発.rb
set :deploy_to, "/var/www/html"
set :user, "myuser"
set :password, "mypassword"
set :scm_passphrase, "mypassword"
そして cat ~/.caprc ファイル:
set :scm_user, "myuser"
最初の展開を行ったユーザーに対して機能します。他のユーザーが自分のマシンで同じことをしようとすると、うまくいきません。
エラーはgitに関連しています。Git は最初のデプロイで git クローンを作成したユーザーを結び付けているようです
基本的にこれらの行で:
executing locally: "git ls-remote ssh://THEOTHERUSER@myserver.com/repo.git HEAD"
* executing "if [ -d /var/www/html/shared/cached-copy ];
then cd /var/www/html/shared/cached-copy
&& git fetch origin
&& git fetch --tags origin
&& git reset --hard 88d6aa98c52babe9368cf2bed36741f0f0b93ff2
&& git submodule init
&& git submodule sync
&& export GIT_RECURSIVE=$([ ! \"`git --version`\" \\< \"git version 1.6.5\" ]
&& echo --recursive)
&& git submodule update --init $GIT_RECURSIVE
&& git clean -d -x -f; else git clone ssh://THEOTHERUSER@myserver.com/repo.git /var/www/html/shared/cached-copy && cd /var/www/html/shared/cached-copy
&& git checkout -b deploy 88d6aa98c52babe9368cf2bed36741f0f0b93ff2
&& git submodule init
&& git submodule sync
&& export GIT_RECURSIVE=$([ ! \"`git --version`\" \\< \"git version 1.6.5\" ]
&& echo --recursive)
&& git submodule update --init $GIT_RECURSIVE; fi"
この問題をデバッグしようとしたとき、THEOTHERUSER ssh アカウントでサーバー マシンにアクセスし、git fetch --tags origin
. 他のユーザーのパスワードを入力するよう求められます。
すべてのユーザーがデプロイできるようにするために何ができるか知っている人はいますか?
アップデート:
何をする必要がありましたか:
set :remote, "#{scm_user}"
set :branch, "master"
http://ruby-doc.org/gems/docs/c/capistrano-edge-2.5.6/Capistrano/Deploy/SCM/Git.html