简体   繁体   中英

Capistrano Deploy Permission Denied

I`m trying to deploy my app Rails 4 app with Capistrano on Amazon EC2 but I keeping getting Acess Denied (publickey).

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

On the remote server I`m able to git clone my repo. Here :

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.

This mean that the ssh keys on the server and on github are ok - but I believe that I missing something on my deploy.rb

Here is the 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

Don't know if I need to give more details, but it seems to be something very newbie that I'm missing. If I don't to use capistrano to continue the deploy, what I need, since I already have my repo on the server ? Thanks in advance

In your very first line, it says the permission issue is happening locally. On your local machine, try running that same command:

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

It's likely that you have not added your local SSH keys to Github.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM