tslocum
tslocum

Reputation: 3422

Heroku on Windows giving error: Contents Invalid public key

Heroku refuses to accept my public key which I generated using puttygen. I tried looking for answers using Google, however the solution of copying the key rather than saving it through puttygen did not solve my issue.

L:\>heroku keys:add "[path]\.ssh\id_rsa.pub"
Uploading ssh public key [path]\.ssh\id_rsa.pub
Enter your Heroku credentials.
Email: [email]
Password:
Uploading ssh public key [path]\.ssh\id_rsa.pub
 !   Contents Invalid public key

I've tried generating several key pairs in case just one was unacceptable and none of them have worked.

Upvotes: 3

Views: 1644

Answers (2)

Rafat Sarosh
Rafat Sarosh

Reputation: 945

If you are using puTTYgen.exe, and saving the public and private key using the UI and then using that public key for heroku then you may get the error of "invalid public key" but the trick is to cut and paste the OpenSSH public key from the UI into a mykey.pub file, and then upload it with heroku keys:add c:\mykey.pub.

Hope it help others.

Upvotes: 18

Kem Mason
Kem Mason

Reputation: 1670

you might try doing a cd to the .ssh directory, and just doing heroku keys:add id_rsa.pub

check the timestamp of the key to make sure that it is the one you just created, the contents of the file should look something like:

ssh-rsa AAAAB3NzaC1kc3MAAACBAIEn8LFH1EaFETOehebaqMR+RaJOTv6BKR6fPcdGqB5d5Hdzsok1PDrXFxRdvmbPfgrMJUFkgXX2917432Lxv8LzthwgWKSnDvtN9kE0A6Mj82pnZMeyf+fCZMvnfb5w70iz6dNVLbDSO3nt65kIeE6cTQsrH+1/PTLjsyJnAWllAAAAFQCEYdQipgY7mdDppo2UqT1XdQeWcQAAAIAcE3w/8CZhkztV9+/R5N56QB4WAIen/fV3AjTHfVVNvhuiSTSst2wRpOEK27wVUz0k0otgUwnpjNt4ECwYj/5a+FXbIKCdcMEHAslCZPQ1R1Q9svrdjKpyw3S/V41OyPMAovfXoJeigfj2DGaStQ8RUFeVm2dpM0+/fodUWf//teJsNRqmGcREq8oz7yFGMHpY5/te4MuVyCMqqlsA8jwAAAIBysaWrJqthkoWfqZ6I4n3Ge7ynoziwjefsllqqkdd++6H7DZKHWybBl985yjuYL5yT9k9sbBgKaOHdp2lo9Kn/pX7Pn87mHNC4BKd+rXkCH5ufFg== [email protected]

Upvotes: 1

Related Questions