无法使用git将应用程序部署到EC2

时间:2013-05-29 11:41:27

标签: ruby-on-rails ssh amazon-ec2 capistrano public-key

我已经设置了amazon EC2实例(工作)和Github repo(运行良好)。 当我尝试使用Github repo将应用程序部署到EC2时,我收到此错误:

 ** [IP] Permission denied (publickey).
 ** [IP] fatal: Could not read from remote repository.
 **
 ** Please make sure you have the correct access rights
 ** and the repository exists.

我错过了什么?我可以使用 copy 将应用程序部署到EC,但不能使用github。

设置公钥我需要什么?

编辑:设置

set :application, "project_name"
set :user, 'username'
set :password, "password"

set :domain, "IP.amazonaws.com"
set :deploy_to, "/path_to_directory"
set :use_sudo, false

role :web, domain
role :app, domain
role :db,  domain, :primary => true 

set :assets_role, [:app]

default_run_options[:pty] = true
set :repository, "git@github.com:user/repo.git"
set :scm, "git"

谢谢

2 个答案:

答案 0 :(得分:0)

您尚未根据错误消息正确设置EC2和Github之间的SSH密钥,但鉴于您提供的信息,无法提供建议。

问题 - 您是否在EC2服务器上设置了部署密钥?我假设您尝试使用SSH代理转发从EC2服务器而不是本地计算机进行部署。你能从EC2服务器到github帐户进行git pull吗?你能ssh到git@github.com(例如“ssh -T git@github.com”)吗?

以下链接可帮助您设置部署密钥或找出管理部署的另一种方法。

https://help.github.com/articles/deploying-with-capistrano

https://help.github.com/articles/managing-deploy-keys

答案 1 :(得分:0)

开始使用Capistrano时调试访问权限的最佳方法之一是尝试在没有它的情况下访问您的服务器。