Reputation: 410
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 [email protected]: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, "[email protected]: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
Upvotes: 1
Views: 1690
Reputation: 3483
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 [email protected]:myuser/myrepo.git HEAD
It's likely that you have not added your local SSH keys to Github.
Upvotes: 2