【问题标题】:Capistrano deploy - Permission deniedCapistrano 部署 - 权限被拒绝
【发布时间】:2016-12-13 17:28:20
【问题描述】:

我正在尝试使用 capistrano 部署我的应用程序,但遇到了一些问题。我的机器是 ec2 amazon,我在本地有 .pem。我可以毫无问题地执行 ssh 和运行命令,但是对于 cap 生产部署,我收到以下错误:

     DEBUG [4f4633f7] Command: ( export GIT_ASKPASS="/bin/echo" GIT_SSH="/tmp/git-ssh-hybrazil-production-ronanlopes.sh" ; /usr/bin/env git ls-remote --heads git@git@github.com:fneto/hybrazil.git )

 DEBUG [4f4633f7]   Permission denied (publickey).

 DEBUG [4f4633f7]   

 DEBUG [4f4633f7]   fatal: Could not read from remote repository.

 DEBUG [4f4633f7]   

 DEBUG [4f4633f7]   

 DEBUG [4f4633f7]   Please make sure you have the correct access rights

 DEBUG [4f4633f7]   

and the repository exists.

 DEBUG [4f4633f7]   

在我的 production/deploy.rb 上,我有这样的配置:

set :ssh_options, {
  keys: %w(/home/ronanlopes/Pems/hybrazil-impulso.pem ~/.ssh/id_rsa),
  forward_agent: true,
  auth_methods: %w(publickey)
}

有什么想法吗?提前致谢!

【问题讨论】:

    标签: amazon-ec2 capistrano


    【解决方案1】:

    您可以将您的密钥添加到代理,使用命令:

    ssh-add ~/.ssh/id_rsa
    

    在您的代码中,您应该使用 ssh 密钥的完整路径,不带 pem:

    keys: %w(/home/user_name/.ssh/id_rsa)
    

    【讨论】:

      猜你喜欢
      • 2014-01-03
      • 2014-04-18
      • 1970-01-01
      • 2023-03-22
      • 1970-01-01
      • 1970-01-01
      • 2012-06-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多