Capistrano部署权限被拒绝

时间:2013-12-16 01:25:27

标签: ruby-on-rails git amazon-ec2 capistrano

我正在尝试在亚马逊EC2上使用Capistrano部署我的应用程序Rails 4应用程序,但我一直拒绝让Acess拒绝(公钥)。

executing locally: "git ls-remote git@github.com:myuser/myrepo.git HEAD"
Permission denied (publickey).
fatal: Could not read from remote repository.

在远程服务器上,我能够克隆我的回购。在这里:

Initialized empty Git repository in /home/ec2-user/myrepo/.git/
remote: Counting objects: 2573, done.
remote: Compressing objects: 100% (1208/1208), done.
remote: Total 2573 (delta 1434), reused 2364 (delta 1225)
Receiving objects: 100% (2573/2573), 26.76 MiB | 2.64 MiB/s, done. 
Resolving deltas: 100% (1434/1434), done.

这意味着服务器和github上的ssh键都没问题 - 但我相信我在deploy.rb上遗漏了一些东西

这是deploy.rb

set :application, "musicjungle"

ssh_options[:keys] = ['~/.ssh/server.pem'] #(This key if the one that I use to connect the instance, I belieive that my error might be here...)
set :scm, "git"
set :repository,  "git@github.com:myuser/myrepo.git"
set :deploy_via, :remote_cache

set :user, 'ec2-user'
set :deploy_to, "/var/www/musicjungle"

set :bundle_without, [:development, :test, :staging]
server '54.200.x.x', :app, :primary =>true

不知道我是否需要提供更多详细信息,但它似乎是我缺少的新手。如果我不使用capistrano继续部署,我需要什么,因为我已经在服务器上有我的回购?提前致谢

1 个答案:

答案 0 :(得分:2)

在你的第一行中,它说权限问题是在本地发生的。在本地计算机上,尝试运行相同的命令:

$ git ls-remote git@github.com:myuser/myrepo.git HEAD

您可能尚未将本地SSH密钥添加到Github。