2016-12-13 182 views
0

我想部署我的应用程序与capistrano,但我有一些问题。我的机器是ec2亚马逊,我本地有.pem。我可以做的ssh和运行没有问题的命令,但对于帽生产部署我得到以下错误:Capistrano部署 - 权限被拒绝

 DEBUG [4f4633f7] Command: (export GIT_ASKPASS="/bin/echo" GIT_SSH="/tmp/git-ssh-hybrazil-production-ronanlopes.sh" ; /usr/bin/env git ls-remote --heads [email protected]@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] 

在我的生产/ deploy.rb,我的配置是这样的:

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

有什么想法?提前致谢!

回答

1

您可以添加您的钥匙剂,使用命令:

ssh-add ~/.ssh/id_rsa 

在你的代码应该使用完整路径SSH密钥,无需PEM:

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