Could not generate ssh public key for heroku in Windows 7

前端 未结 4 1401
不知归路
不知归路 2021-02-12 01:55

While I am trying heroku login through cmd in my machine, it says

Could not find existing public key
Would you like to generate one? [

4条回答
  •  庸人自扰
    2021-02-12 02:08

    Windows 10-64bit

    I had installed git, then heroku toolbelt (which I think reinstalled git)

    I had C\Program Files (x86)\Heroku\bin in my Environmental variable (probably generated when I installed heroku toolbelt) and if I looked in that filepath I had an ssh-keygen.bat - so it seemed like I should be able to just run ssh-keygen -t rsa from the command line.

    That would be too easy, instead I get:

    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.
    

    Solution

    type bash in command line to go into git bash mode then run 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:
    

    Now when I look in C/User/mamwo/.ssh (the best way for me is through pycharms folder - windows sucks) I see my id_rsa and id_rsa.pub

    But this 'cannot generate publickeys' issue all started for me because I had an 'I don't have public keys to add' issue when I cloned my repo (from github) to a new computer and found that I could push to github but not heroku.

    Now that I have the keys - I have to add them

    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]
    

提交回复
热议问题