Windows 10-64 位
我已经安装了 git,然后是 heroku toolbelt(我认为它重新安装了 git)
我的环境变量中有C\Program Files (x86)\Heroku\bin(可能是在我安装heroku 工具带时生成的),如果我查看那个文件路径,我有一个ssh-keygen.bat - 所以看起来我应该能够运行@987654322 @ 从命令行。
这太容易了,我得到了:
C:\Program Files (x86)\Git\bin>ssh-keygen -t rsa -f id_rsa
'"C:\Program Files (x86)\Heroku\..\Git\bin\ssh-keygen.exe"' is not recognized as an internal or external command,
operable program or batch file.
解决方案
输入bash 在命令行中进入git bash模式然后运行ssh-keygen -t rsa
git bash:
mamwo@DESKTOP-9GVG6K8 MINGW32 /bin
$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/mamwo/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/mamwo/.ssh/id_rsa.
Your public key has been saved in /c/Users/mamwo/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:MMMYYYPPPUUUBBBLLIIICCKKEEEEYYYY mamwo@DESKTOP-9GVG6K8
The key's randomart image is:
现在,当我查看 C/User/mamwo/.ssh(对我来说最好的方法是通过 pycharms 文件夹 - Windows 很烂)时,我看到了我的 id_rsa 和 id_rsa.pub
但是这个“无法生成公钥”问题都是由我开始的,因为当我将我的仓库(从 github)克隆到新计算机并发现我可以推送时,我遇到了一个“我没有要添加的公钥”的问题到 github 但不是 heroku。
现在我有了钥匙 - 我必须添加它们
C:\Users\mamwo\Desktop\mv>git push heroku master
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
C:\Users\mamwo\Desktop\mv>heroku keys
You have no keys.
C:\Users\mamwo\Desktop\mv>heroku keys:add
Found an SSH public key at C:/Users/mamwo/.ssh/id_rsa.pub
Would you like to upload it to Heroku? [Yn]