4

获取github存储bitbucket库。

无法确定主机 'github.com (some_ip_address)' 的真实性。

这是我的部署文件。deploy:setup并且deploy:check工作正常。

require "bundler/capistrano" 
require "rvm/capistrano"

default_run_options[:pty] = true 
ssh_options[:forward_agent] = true

set :repository, 'ssh://git@bitbucket.org/username/repo.git' 
set :scm :git 
set :scm_verbose, true
set :user, 'root'
set :deploy_via, :remote_cache
set :migrate_target, :current
set :branch, 'master'
set :application, 'my_app_name' 
set :domain, 'my_domain_ip_address'
set :applicationdir, "/home/deploy/domains/#{application}"
set :deploy_to, "/home/deploy/domains/#{application}"
role :web, domain role :app, domain role :db,  domain, :primary => true
set :keep_releases, 5
set :rvm_type, :system

after 'deploy:restart', 'deploy:cleanup'

namespace :deploy do   
  task :start do ; end   
  task :stop do ; end   
  task :restart, :roles => :app, :except => { :no_release => true } do
    run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
    run "#{try_sudo} chmod 777 #{File.join(current_path,'tmp/')}"
    run "#{try_sudo} chmod 777 #{File.join(current_path,'log/')}"
  end
  task :after_deploy do
    run "cd #{current_path} && bundle install --deployment"
    run "cd #{current_path}; RAILS_ENV=#{rails_env} bundle exec rake db:migrate"
    run "#{try_sudo} chmod 777 -R #{current_path}/tmp/"
    run "#{try_sudo} chmod 777 -R #{current_path}/log/"
    run "#{try_sudo} chmod 777 . #{current_path}/log/"   
  end 
end

after 'deploy', 'deploy:after_deploy'

注意:我第一次尝试部署 rails 应用程序。

Server: Digital Ocean VPS

Repository: bitbucket.org

我在帐户中添加ssh key了。serverbitbucket

问题: While 'cap:deploy',执行后deploy,deploy:update,deploy:update_code,deploy:finalize_update,deploy:assets:symlink,

在执行时遇到问题,在使用时'bundle install'要求github真实性bitbucket

4

1 回答 1

7

尝试设置git URL这样

set :repository, 'git@bitbucket.org:username/repo.git'

如果您还没有添加keys到 bitbucket,您可以在此处添加https://bitbucket.org/account/user/username/ssh-keys/

于 2013-09-10T07:15:24.767 回答