git push heroku master permission denied

前端 未结 7 1973
有刺的猬
有刺的猬 2021-01-31 02:04

I am following the ruby.railstutorial. I run the command \"git push heroku master\" and it spits out this error.

Permission denied (publickey).
fatal: Could not          


        
7条回答
  •  离开以前
    2021-01-31 02:41

    I created a key with

    ssh-keygen -t rsa
    

    and used a different filename than id_rsa (in my case heroku). I added the key to heroku with

    heroku keys:add
    

    On trying to push my master branch to heroku I always received the following error:

    $ git push heroku master
    The authenticity of host 'heroku.com
    (50.19.85.132)' can't be established. RSA key fingerprint is
    8b:48:5e:67:0e:c9:16:47:32:99:87:0c:1f:c8:60:bb. Are you sure you want
    to continue connecting (yes/no)? yes Warning: Permanently added
    'heroku.com,50.19.85.132' (RSA) to the list of known hosts. Permission
    denied (publickey). fatal: Could not read from remote repository.

    Please make sure you have the correct access rights and the repository exists.

    As I noticed git only used my id_rsa key from another ssh-access (you can check that via your git gui: Help -> SSH keys).

    I renamed my .ssh directory C:\Users\%username%.ssh to .ssh.bak and copied my heroku private and public key (from the .ssh.bak directory) to a newly created .ssh directory and named it id_rsa (and id_rsa.pub).

    Now pushing worked as expected:

    git push heroku master
    

提交回复
热议问题