{"id":6533,"date":"2014-04-20T08:17:20","date_gmt":"2014-04-20T08:17:20","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/04\/20\/ssh-publickey-error-when-trying-to-push-to-server-using-git-collection-of-common-programming-errors-2\/"},"modified":"2014-04-20T08:17:20","modified_gmt":"2014-04-20T08:17:20","slug":"ssh-publickey-error-when-trying-to-push-to-server-using-git-collection-of-common-programming-errors-2","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/04\/20\/ssh-publickey-error-when-trying-to-push-to-server-using-git-collection-of-common-programming-errors-2\/","title":{"rendered":"SSH publickey error when trying to push to server using git-Collection of common programming errors"},"content":{"rendered":"<p>I am trying to use this tutorial to set up a git remote repo on my server: http:\/\/toroid.org\/ams\/git-website-howto<\/p>\n<p>But when I try to push to the server, I get this error:<\/p>\n<pre><code>Permission denied (publickey).\nfatal: The remote end hung up unexpectedly\n<\/code><\/pre>\n<p>So it seems like git can&#8217;t ssh the server because of some auth key issue. I can SSH into the server fine from Terminal by using <code>ssh aws1<\/code> due to the set up of my ssh config file.<\/p>\n<p>~\/.ssh\/config file:<\/p>\n<pre><code>Host aws1\n        HostName 54.235.193.228\n        User ubuntu\n        IdentityFile ~\/.ssh\/ec2_key.pem\n<\/code><\/pre>\n<p>The git commands I am using to add the remote and push:<\/p>\n<pre><code>git remote add web  ssh:\/\/54.235.193.228\/home\/ubuntu\/somedirectory.git \n\ngit push web +master:refs\/heads\/master\n<\/code><\/pre>\n<p>I think my problem is i don&#8217;t quite understand fully how to use ssh key-pairs. The tutorial says:<\/p>\n<blockquote>\n<p>&#8220;I assume that the web site will live on a server to which you have ssh access, and that things are set up so that you can ssh to it without having to type a password (i.e., that your public key is in ~\/.ssh\/authorized_keys and you are running ssh-agent locally).&#8221;<\/p>\n<\/blockquote>\n<p>I don&#8217;t know what ssh-agent is and I don&#8217;t even have an authorized_keys file on my machine (I do have one called known_hosts). I thought using the ssh config file would be adequate because that allows me to ssh from the terminal without a password but apparently that is not correct. What am I doing wrong?<\/p>\n<p>Server: EC2 instance, Ubuntu 12.04, AWS elastic ip<\/p>\n<p>Dev Machine: OS X 10.7.5, zsh shell<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I am trying to use this tutorial to set up a git remote repo on my server: http:\/\/toroid.org\/ams\/git-website-howto But when I try to push to the server, I get this error: Permission denied (publickey). fatal: The remote end hung up unexpectedly So it seems like git can&#8217;t ssh the server because of some auth key [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-6533","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6533","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=6533"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6533\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=6533"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=6533"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=6533"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}