Issues with Go and Github - SSH Keys?

Follow

Comments

5 comments

  • Avatar
    b4dg3rz

    Cracked it!


    Essentially I needed to create a key for go user, and add this to github. Simple as!

  • Avatar
    Dave Green

    I've essentially got the same problem as this. I created a public key whilst logged in as the Go user within the ~/.ssh and uploaded this to my Git repository. I've then done a clone manually on the box to ensure it works, I have made sure there is no passphrase on the key and everything went as expected.


    When Go tries to execute git clone I get this error message "Failed to run git clone command ERROR: Permission denied (publickey). ERROR: fatal: The remote end hung up unexpectedly". Any ideas if I put the public key in the right place when I generated it or is there anything else I should of done?

  • Avatar
    b4dg3rz

    You probably put the go key in the wrong place perhaps. When su to the "go" user, the key was placed by default in /var/go/.ssh


    This is what I did (on Ubuntu 11.0.4)


    > sudo su go


    > ssh-keygen


    > ssh-add /var/go/.ssh/id_rsa


    I couldn't initially add the key as ssh-agent wasn't running so I had to:


    > exec ssh-agent /usr/bin/bash


    > ssh-add /var/go/.ssh/id_rsa


    then, to get the public key


    > cat /var/go/.ssh/id_rsa.pub


    Which I copied into github


    then, test the connection


    > ssh -vT git@github.com


    It'll ask you to say yes or no to the connection.


    Then it worked.

  • Avatar
    Dave Green

    After more investigation, I installed a Go Server on my machine and it works correctly. On the main server still no joy. The difference I have noticed though is on our production server Go is installed on the E drive so I think there is a posiblity Go is not looking in the correct place for the key files. Not sure how I can prove this ... Git is installed on the C: drive by the way.

  • Avatar
    Nick Karnik

    Thank you!!! Creating the key for the go user worked.... I did "sudo su" and "su go", then "ssh-keygen -t rsa" and finally "git ls-remote URLtoGit" and accepted the fingerprint. Then, my connection worked.

Please sign in to leave a comment.