我正在尝试使用capistrano部署我的应用程序,但我遇到了一些问题。我的机器是ec2亚马逊,我在本地有.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)
}
任何想法?提前谢谢!
答案 0 :(得分:1)
您可以将密钥添加到代理,使用命令:
ssh-add ~/.ssh/id_rsa
在你的代码中,你应该使用ssh键的完整路径,而不是pem:
keys: %w(/home/user_name/.ssh/id_rsa)