deploy with capistrano using a pem file

五迷三道 提交于 2021-02-05 13:43:41

问题


We have a EC2 instance, and our capistrano setup requires ssh. To connect through ssh normally, I use a .pem file for connecting to the server. how do I utilize this .pem file when using capistrano to deploy?


回答1:


In deploy.rb set these configuration values:

default_run_options[:pty] = true
ssh_options[:forward_agent] = true
ssh_options[:auth_methods] = ["publickey"]
ssh_options[:keys] = ["/path/to/key.pem"]

For Capistrano 3 use:

set :pty, true
set :ssh_options, {
  forward_agent: true,
  auth_methods: %w[publickey],
  keys: %w[/path/to/key.pem]
}



回答2:


for capistrano 3 the syntax is somewhat different

set :pty, true

set :ssh_options, {
  forward_agent: true,
  auth_methods: ["publickey"],
  keys: ["/path/to/key.pem"]
}


来源:https://stackoverflow.com/questions/12967918/deploy-with-capistrano-using-a-pem-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!