ruby-on-rails – Capistrano和GitHub Private Repo – 权限被拒
我继承了一个在Linode上托管的Rails项目.
之前的开发人员使用BitBucket存储库以及Capistrano进行部署. 我已经在GitHub上设置了一个私有存储库,我正试图让Capistrano的配方工作.我没有运气.我在部署期间继续收到publickey错误. 以下是我采取的步骤 – >更新了Linode服务器上的Git远程(源)URL以指向我的新存储库 另外,为了防止forward_agent属性不起作用,我甚至尝试在Linode服务器上生成SSH密钥,并将其添加到GitHub.没运气. 完成所有这些后,当我运行cap deploy时,我收到以下错误: Permission denied (publickey). fatal: The remote end hung up unexpectedly 以下是我正在使用的食谱 – require "bundler/capistrano" server "----SERVER IP----",:web,:app,:db,primary: true set :application,"blog" set :user,"deployer" set :deploy_to,"/var/www/blog" set :deploy_via,:remote_cache set :use_sudo,false set :scm,"git" set :repository,"git@github.com:--MY USERNAME--/blog.git" set :branch,"master" default_run_options[:pty] = true ssh_options[:forward_agent] = true after "deploy","deploy:cleanup" # keep only the last 5 releases namespace :deploy do task :start do; end task :stop do; end task :restart,roles: :app,except: {no_release: true} do run "touch #{deploy_to}/current/tmp/restart.txt" end task :setup_config,roles: :app do sudo "ln -nfs #{current_path}/config/apache.conf /etc/apache2/sites-available/blog" run "mkdir -p #{shared_path}/config" put File.read("config/database.example.yml"),"#{shared_path}/config/database.yml" puts "Now edit the config files in #{shared_path}." end after "deploy:setup","deploy:setup_config" task :symlink_config,roles: :app do run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml" run "ln -nfs #{shared_path}/public/avatars #{release_path}/public/avatars" end after "deploy:finalize_update","deploy:symlink_config" desc "Make sure local git is in sync with remote." task :check_revision,roles: :web do unless `git rev-parse HEAD` == `git rev-parse origin/master` puts "WARNING: HEAD is not the same as origin/master" puts "Run `git push` to sync changes." exit end end before "deploy","deploy:check_revision" end 我似乎无法弄清楚我哪里出错了 – 任何帮助都会非常感激. UPDATE 我还确保将以下内容添加到我的本地?/ .ssh / config文件中… Host mydomain.com ForwardAgent yes 解决方法
今天我找到了MAC的根本原因.我的ssh密钥未添加到身份验证代理,因此密钥未转发.解决方案是执行以下命令:
(或者如果你使用rsa键,则ssh-add~ / .ssh / id_rsa) (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |