cap deploy leads to "Permission denied (publickey)" but my ssh keys should be set up

3,182 views
Skip to first unread message

David Zhang

unread,
Jun 21, 2011, 10:58:12 PM6/21/11
to capis...@googlegroups.com
I recently moved my ~/.ssh folder contents to my new laptop in the typical ~/.ssh folder.  I was hoping to be able to use "cap deploy" on my new laptop to continue working with a Rails application I already had in production (it's the command I'd comfortably use on my old laptop).  A little more background - the application is on GitHub, and I've set up the necessary Rails things on my new computer.  

"git push" and "git pull" work fine, but oddly "cap deploy" leads to the  "Permission denied (publickey)" error.... which I would think shouldn't happen because the ssh keys should be the same.  I can even ssh into the server of my app with no problem on my new comp.

The Rails app is deployed on Linux... Um... oh - please understand that I've never actually deployed an app myself with capistrano, i.e. with all the setup with something like Passenger - someone else did it and sort of left me with everything :/.  I don't have a deep understanding of how ssh keys and capistrano and the deployment system work together... 

(I hope this is enough information, and help would REALLY be appreciated)

Rafa García

unread,
Jun 22, 2011, 4:59:10 AM6/22/11
to capis...@googlegroups.com
Hi David, 

  Try adding your keys to your ssh agent with the command:

    $ ssh-add

Regards

2011/6/22 David Zhang <dzha...@gmail.com>
--
* You received this message because you are subscribed to the Google Groups "Capistrano" group.
* To post to this group, send email to capis...@googlegroups.com
* To unsubscribe from this group, send email to capistrano+...@googlegroups.com For more options, visit this group at http://groups.google.com/group/capistrano?hl=en

David Zhang

unread,
Jun 22, 2011, 5:41:10 PM6/22/11
to capis...@googlegroups.com
Do I run that anywhere on my new machine in the cmd? (thanks btw)

David Zhang

unread,
Jun 22, 2011, 9:08:07 PM6/22/11
to capis...@googlegroups.com
Wow.. that did it.  So all I had to do was run "ssh-add" in the cmd.  Thank you!

Just curious - would editing the email at the end of any of the ssh keys anywhere (from the authorized_keys2 file on the server to the id_rsa.pub file I have on my computer and on GitHub) affect anything?  Someone told me they don't matter...

Hassan Schroeder

unread,
Jun 22, 2011, 6:10:05 PM6/22/11
to capis...@googlegroups.com
On Tue, Jun 21, 2011 at 7:58 PM, David Zhang <dzha...@gmail.com> wrote:

> "git push" and "git pull" work fine, but oddly "cap deploy" leads to the
>  "Permission denied (publickey)" error....

What does
ssh g...@github.com
produce, on both your new laptop and the server itself?

For details on what to expect and how to fix it if it fails, see:
http://help.github.com/mac-set-up-git/

HTH,
--
Hassan Schroeder ------------------------ hassan.s...@gmail.com
http://about.me/hassanschroeder
twitter: @hassan

Rafa García

unread,
Jun 22, 2011, 6:36:06 PM6/22/11
to capis...@googlegroups.com

Execute it in your new laptop.

Sorry for be brief , I'm replying from my mobile.

Sent from my Samsung Galaxy SII

Rafa García

unread,
Jun 23, 2011, 3:39:14 AM6/23/11
to capis...@googlegroups.com
I'm not sure about this, you can do the test and tell us the results :)

I guess, newest ubuntu version uses ssh-agent by default then you need to add the keys (ssh-add) to the agent, but I'm not sure because my knowledge about ssh is not very advanced(only to survive).

Regards

2011/6/23 David Zhang <dzha...@gmail.com>
Wow.. that did it.  So all I had to do was run "ssh-add" in the cmd.  Thank you!

Just curious - would editing the email at the end of any of the ssh keys anywhere (from the authorized_keys2 file on the server to the id_rsa.pub file I have on my computer and on GitHub) affect anything?  Someone told me they don't matter...

--

David Zhang

unread,
Jun 23, 2011, 3:57:56 PM6/23/11
to capis...@googlegroups.com
ssh g...@github.com works successfully on my new laptop. i.e. it returns the proper output mentioned here: http://help.github.com/mac-set-up-git/

Changing the email at the end does not affect anything.  Well, I had to do ssh-add again oddly, but I'm not concerned about that.

Thank you.

Rafa García

unread,
Jun 24, 2011, 2:53:12 AM6/24/11
to capis...@googlegroups.com
Thanks, It's good to know it :)

2011/6/23 David Zhang <dzha...@gmail.com>
ssh g...@github.com works successfully on my new laptop. i.e. it returns the proper output mentioned here: http://help.github.com/mac-set-up-git/

Changing the email at the end does not affect anything.  Well, I had to do ssh-add again oddly, but I'm not concerned about that.

Thank you.

--
Reply all
Reply to author
Forward
0 new messages