Windows 上的 Heroku 出现错误:内容无效的公钥
Heroku 拒绝接受我使用 puttygen 生成的公钥。我尝试使用 Google 寻找答案,但是复制密钥而不是通过 puttygen 保存密钥的解决方案并没有解决我的问题。
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
我尝试生成几个密钥对,以防只有一个密钥对不可接受并且它们都不起作用。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您使用 puTTYgen.exe,并使用 UI 保存公钥和私钥,然后将该公钥用于 heroku,那么您可能会收到“无效公钥”的错误,但技巧是剪切并粘贴 OpenSSH 公钥从 UI 导入到 mykey.pub 文件中,然后使用 heroku keys 上传:add c:\mykey.pub。
希望它对其他人有帮助。
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.
您可以尝试执行 cd 到 .ssh 目录,然后执行
heroku keys:add id_rsa.pub
检查密钥的时间戳以确保它是您刚刚创建的密钥,文件的内容应类似于:
ssh-rsa AAAAB3NzaC1kc3MAAACBAIEn8LFH1EaFETOehebaqMR+RaJOTv6BKR6fPcdGqB5d5Hdzsok1PDrXFxRdvmbPfgrMJUFkgXX291743 2Lxv8LzthwgWKSnDvtN9kE0A6Mj82pnZMeyf+fCZMvnfb5w70iz6dNVLbDSO3nt65kIeE6cT QsrH+1/PTLjsyJnAWllAAAAFQCEYdQipgY7mdDppo2UqT1XdQeWcQAAAIAce3w/8CZhkztV9 +/ R5N56QB4WAIen/fV3AjTHfVVNvhuiSTSst2wRpOEK27wVUz0k0otgUwnpjNt4ECwYj/5a+FXbIKCdcMEHAslCZPQ1R1Q9svrdjKpyw3S/V41OyPMAovfXoJeigfj2DGaStQ8RUFeVm2dpM0+/fo dUWf//teJsNRqmGcREq8oz7yFGMHpY5/te4MuVyCMqqlsA8jwAAAIBysaWrJqthkoWfqZ6I4n3Ge7ynoziwjefsllqqkdd++6H7DZKHWybBl985yjuYL5yT9k9sbBgKaOHdp2lo9Kn/pX7Pn87mHNC4 BKd+rXkCH5ufFg== [电子邮件受保护]
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]