当尝试使用Capistrano将Rails应用程序部署到生产服务器时,尽管我直接从GitHub克隆了项目,但它似乎并不认为我的项目是git仓库。
GIT日志:
$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
CAP日志:
$ cap production deploy
triggering load callbacks
* 2016-06-01 16:30:26 executing `production'
triggering start callbacks for `deploy'
* 2016-06-01 16:30:26 executing `multistage:ensure'
* 2016-06-01 16:30:26 executing `deploy'
* 2016-06-01 16:30:26 executing `deploy:update'
** transaction: start
* 2016-06-01 16:30:26 executing `deploy:update_code'
executing locally: "git ls-remote git@github.com:mitigation/mpm.git r1"
command finished in 662ms
* refreshing local cache to revision 8c86d067abde1464f88902566324a99e22cd3147 at /var/folders/xs/5qz1glwj30v51rwpxhyclw880000gn/T/mpm
executing locally: cd /var/folders/xs/5qz1glwj30v51rwpxhyclw880000gn/T/mpm && git fetch -q origin && git fetch --tags -q origin && git reset -q --hard 8c86d067abde1464f88902566324a99e22cd3147 && git clean -q -d -x -f
fatal: Not a git repository (or any of the parent directories): .git
command finished in 13ms
shell command failed with return code pid 52560 exit 128
这是我的Capfile:
load 'deploy'
load 'deploy/assets'
load 'config/deploy'
这是我的DEPLOY.RB:
require 'soprano'
require 'bundler/capistrano'
require 'capistrano/ext/multistage'
require 'whenever/capistrano'
require 'leipreachan/capistrano2'
set :default_environment, {
'PATH' => '/home/deploy/.rbenv/shims:/home/deploy/.rbenv/bin:$PATH'
}
set :web_server, :nginx
set :keep_releases, 3
set :repository, 'git@github.com:mitigation/mpm.git'
set :deploy_via, :copy
set :copy_exclude, %w(.git .idea .yardoc tmp log .DS_Store doc/* public/uploads.tar db/*.sql vendor/cache)
set :copy_cache, true
set :bundle_without, [:development, :test]
set :bundle_flags, '--deployment --binstubs'
set :user, 'deploy'
before 'deploy:setup', :db
after 'deploy:create_symlink', 'utils:version'
after 'deploy:update_code', 'db:symlink'
#For troubleshooting only
namespace :deploy do
task :update_code, :except => { :no_release => true } do
#on_rollback { run "rm -rf #{release_path}; true" }
strategy.deploy!
finalize_update
end
end
答案 0 :(得分:0)
在部署到各种环境的过程中, capistrano3 会创建一个目录树,并将git信息放在名为repo_path的文件夹中。您必须在生产服务器上的该目录中旅行,并且“ $ git log ”表示它的.git repo
你也不需要在copy_exclude中使用.git。
尝试使用适用于不同环境的应用重新执行 capistrano3 设置过程。