Heroku error: “Permission denied (public key)”

前端 未结 6 547
梦毁少年i
梦毁少年i 2020-12-22 18:39

I keep getting this error. I am using Mac. I generated a key and added it to heroku using

heroku config:add key=\"ssh-rsa blahblah=me@me.com\"

相关标签:
6条回答
  • 2020-12-22 19:07

    Try heroku keys:add <path-to-your-public-key>.

    For example, heroku keys:add ~/.ssh/id_rsa.pub

    0 讨论(0)
  • 2020-12-22 19:07

    Copy the files in your .ssh path ex:

    /c/Users/<yourusername>/.ssh/<files>
    

    to the git .ssh folder.

    /c/Program Files/Git/.ssh/<paste files here>
    

    If the .ssh folder doesn't exist in the Git directory simply create it then paste your files.

    For some reason windows require that a .ssh path be in the user directory as well as the Git directory. ON default this is not added so you simply have to create it yourself.

    After adding the files to Git's directory simply run the following command again:

    git push heroku master
    
    0 讨论(0)
  • 2020-12-22 19:10

    i faced the same issue . Writing my experience so it helps someone else .

    I tried to follow the instructions that were detialed on the official website -Getting Started with Your Facebook App on Heroku

    Even though it is quite detialed especially the video it is quite annoying to note that they do not mention having to set up SSH keys . Either it is set by default ( i dont know ) or you get the error mentioned by the question poster .

    So i did the following :

    1 . opened up the git shell

    2 . typed the following in

    C:\Users\blue\Documents\GitHub> heroku keys:add
    Found the following SSH public keys:
    1) github_rsa.pub
    2) id_rsa.pub
    Which would you like to use with your Heroku account? 2
    

    3 . Subsequent to this i was able to getcheckout my repository

    C:\Users\blue\Documents\GitHub> heroku login
    Enter your Heroku credentials.
    Email: sxxxxt.xxxx@gmail.com
    Password (typing will be hidden):
    Authentication successful.
    C:\Users\blue\Documents\GitHub> git clone git@heroku.com:sxxxd-plains-8530.gi
    t
    Cloning into 'sxxxd-plains-8530'...
    Warning: Permanently added 'heroku.com,50.19.85.154' (RSA) to the list of known
    hosts.
    remote: Counting objects: 180, done.
    remote: Compressing objects: 100% (112/112), done.
    remote: Total 180 (delta 82), reused 132 (delta 62)
    Receiving objects:  81% (146/180), 76.00 KiB | 62 KiB/s
    Receiving objects: 100% (180/180), 137.91 KiB | 62 KiB/s, done.
    Resolving deltas: 100% (82/82), done.
    C:\Users\blue\Documents\GitHub>
    

    Please dont downvote my answer . Even though i dont add any new value to what is already posted but i hope my experiences will help someone who is new to using git & heruko . Hence i added screen shots .

    • My 2 cents
    0 讨论(0)
  • 2020-12-22 19:21

    This could also indicate API issues. Make sure to check https://status.heroku.com

    0 讨论(0)
  • 2020-12-22 19:26

    if you dont have ssh key yet then try generating it using below command :

    1. ssh-keygen -t rsa -C "your_email@example.com"
    2. ssh-add
    

    For getting rid of heroku permission denied (public key) add your keys to heroku using:

    3. heroku keys:add <path_to_your_ssh>
        OR
     heroku keys:add
    

    For getting rid of Github permission denied (public key) add your keys to Github using:

    4. ssh-add <path_to_your_ssh> 
         OR
      ssh-add
    
    0 讨论(0)
  • 2020-12-22 19:32

    the solution above did not work for me as I did not have any keys generated in my ~/.ssh folder.

    My solution was to simply type heroku keys:add

    The output in terminal was:

    Could not find an existing public key.
    Would you like to generate one? [Yn] y
    Generating new SSH public key.
    Uploading SSH public key /home/funkdified/.ssh/id_rsa.pub... done
    

    See: https://devcenter.heroku.com/articles/keys

    0 讨论(0)
提交回复
热议问题