• Home
  • About

stonean

Feeds:
Posts
Comments

github and public key

April 17, 2008 by stonean

If you haven’t heard, everyone is moving to git. Not really sure why yet, I like svn, but felt like I should probably keep in touch. I have a need to create a Stage generator for Merb, so I thought this would be a good opportunity. Quick note: the Stage generator for Merb will be a refactor which I will port to Rails later.

The account setup at github was easy and I followed the directions for providing my public key. Checked and double checked.

I then added my repository and followed the following steps (also from github):

$ mkdir stage
$ cd stage
$ git init
$ touch README
$ git add README
$ git commit -m 'first commit'
$ git remote add origin git@github.com:stonean/stage.git
$ git push origin master

I get to the last step and try the push. Ooops:

$ git push origin master
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
error: failed to push to 'git@github.com:stonean/stage.git'

I knew it was a configuration issue, just wasn’t sure if it was a git thing or not. After a minute or two of thinking it through, all I needed to do was:

$ cd ~/.ssh
$ ssh-add id_rsa

I then re-tried the push command, and it worked. Cool.

UPDATE: Can just do ssh-add without being in the .ssh directory

Posted in git | 9 Comments

9 Responses

  1. on April 23, 2008 at 1:29 am greengaloshes.cc

    This was helpful – I got stuck at the same point you did, and the ssh-add worked for me – thanks!


  2. on May 4, 2008 at 1:09 pm Anonymous

    Didn’t work for me:

    $ ssh-add id_rsa
    Could not open a connection to your authentication agent.


  3. on May 9, 2008 at 1:11 pm Noam

    This worked for me, thanks!


  4. on May 20, 2008 at 1:46 pm LesFreeman

    If anyone else gets this message:
    Could not open a connection to your authentication agent.

    Look here for some good advice:
    http://www.cs.indiana.edu/csg/FAQ/Security/openssh.html


  5. on May 20, 2008 at 1:56 pm Andrew Stone

    Thanks for the additional info, much appreciated.


  6. on July 2, 2008 at 11:33 am JJ

    Another thanks from here. Really helpful.


  7. on October 22, 2008 at 3:53 pm Julien

    Thanks for this!
    Merci pour ceci!


  8. on November 25, 2008 at 8:53 am web architecte

    i cant solve it, i’m new in Mac, would you see following

    macmini:cake-test macmini$ git push origin master
    Permission denied (publickey).
    fatal: The remote end hung up unexpectedly
    macmini:cake-test macmini$ cd ~/.ssh
    macmini:.ssh macmini$ ssh-add id_rsa
    id_rsa: No such file or directory


  9. on December 18, 2008 at 8:00 pm Fu

    Thanks a lot, worked like a charm. The only weird thing is that I had to do it again when I tried to commit for the second time, but I’ll look into that latter. Thanks again.

    Cheers,
    Rafael.



Comments are closed.

  • Open Source


    Lockdown (GitHub)
    RuHL (GitHub)

  • Recommend Me

  • twitter: stonean

    • So I submitted my RailsConf proposal, called it Beyond MVC. We shall see. I do such a bad job talking about myself, the bio sucked. 7 hours ago
    • @ubermuda that's good to know, thank you! 1 day ago
    • @chanmix51 cool, thanks! 1 day ago
    • In vi, :set list to show hidden characters, to revert, :set nolist Very handy. 1 day ago
    • Team just did their first PechaKucha [ http://vurl.me/EEP ] session. I love this format and am very impressed with results! 2 days ago
  • Categories

    classy-inheritance Code Style DataMapper Fusion git Haml Interview Questions jQuery lockdown Merb MysqlUtils Process Quick Tips REST RSpec Ruby RubyOnRails rubytrends Stage thoughts Uncategorized


  • Archives

    • November 2009
    • May 2009
    • April 2009
    • March 2009
    • February 2009
    • January 2009
    • December 2008
    • November 2008
    • October 2008
    • August 2008
    • July 2008
    • June 2008
    • May 2008
    • April 2008
    • March 2008
    • February 2008
    • January 2008
    • December 2007
    • November 2007

Blog at WordPress.com.

Theme: Mistylook by Sadish.