Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You have to upload your public key to Heroku:</p> <pre><code>heroku keys:add ~/.ssh/id_rsa.pub </code></pre> <p>If you don't have a public key, Heroku will prompt you to add one automatically which works seamlessly. Just use: </p> <pre><code>heroku keys:add </code></pre> <p>To clear all your previous keys do :</p> <pre><code>heroku keys:clear </code></pre> <p>To display all your existing keys do :</p> <pre><code>heroku keys </code></pre> <p>EDIT:</p> <p>The above did not seem to work for me. I had messed around with the <code>HOME</code> environment variable and so SSH was searching for keys in the wrong directory.</p> <p>To ensure that SSH checks for the key in the correct directory do :</p> <pre><code>ssh -vT git@heroku.com </code></pre> <p>Which will display the following ( Sample ) lines</p> <pre><code>OpenSSH_4.6p1, OpenSSL 0.9.8e 23 Feb 2007 debug1: Connecting to heroku.com [50.19.85.156] port 22. debug1: Connection established. debug1: identity file /c/Wrong/Directory/.ssh/identity type -1 debug1: identity file /c/Wrong/Directory/.ssh/id_rsa type -1 debug1: identity file /c/Wrong/Directory/.ssh/id_dsa type -1 debug1: Remote protocol version 2.0, remote software version Twisted debug1: no match: Twisted debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_4.6 debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: server-&gt;client aes128-cbc hmac-md5 none debug1: kex: client-&gt;server aes128-cbc hmac-md5 none debug1: sending SSH2_MSG_KEXDH_INIT debug1: expecting SSH2_MSG_KEXDH_REPLY debug1: Host 'heroku.com' is known and matches the RSA host key. debug1: Found key in /c/Wrong/Directory/.ssh/known_hosts:1 debug1: ssh_rsa_verify: signature correct debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug1: SSH2_MSG_SERVICE_REQUEST sent debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: publickey debug1: Next authentication method: publickey debug1: Trying private key: /c/Wrong/Directory/.ssh/identity debug1: Trying private key: /c/Wrong/Directory/.ssh/id_rsa debug1: Trying private key: /c/Wrong/Directory/.ssh/id_dsa debug1: No more authentication methods to try. </code></pre> <p><strong><code>Permission denied (publickey).</code></strong></p> <p>From the above you could observe that ssh looks for the keys in the <code>/c/Wrong/Directory/.ssh</code> directory which is not where we have the public keys that we just added to heroku ( using <code>heroku keys:add ~/.ssh/id_rsa.pub</code> ) ( <strong>Please note that in windows OS <code>~</code> refers to the <code>HOME</code> path which in win 7 / 8 is <code>C:\Users\UserName</code></strong> )</p> <p>To view your current home directory do : <code>echo $HOME</code> or <code>echo %HOME%</code> ( Windows )</p> <p>To set your <code>HOME</code> directory correctly ( by correctly I mean the parent directory of <code>.ssh</code> directory, so that ssh could look for keys in the correct directory ) refer these links :</p> <ol> <li><p><a href="https://unix.stackexchange.com/questions/21598/how-do-i-set-a-user-environment-variable-permanently-not-session">SO Answer on how to set Unix environment variable permanently</a></p></li> <li><p><a href="https://stackoverflow.com/questions/2840871/ssh-is-looking-in-the-wrong-place-for-the-public-private-key-pair-on-windows">SO Question regarding ssh looking for keys in the wrong directory and a solution for the same.</a></p></li> </ol>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload