Unable to push git repo to Heroku, despite valid SSH keys

后端 未结 4 1748
花落未央
花落未央 2021-02-03 13:44

There are lots of stack articles citing the same error message as I am getting.

I went through the entire heroku setup doc on another computer and everything worked perf

4条回答
  •  余生分开走
    2021-02-03 14:29

    This question is not really about git than about ssh. :)

    Heroku uses git which uses ssh which allows only authentication by publickey. (But I think that is already clear.)

    heroku keys:add will send the public key to heroku. Unless you specify an explicit key it will use ~/.ssh/id_[rd]sa.pub.

    To authenticate successfully you need to present the matching private key. Unless specified otherwise ssh will use ~/.ssh/id_[rd]sa, but it will refuse to read it if permissions are too loose. (See man ssh section FILES for details.)

    An easy way to check whether the permissions are fine is to add the key to the agent: ssh-add ~/.ssh/id_[rd]sa

    This should either add the key to the agent (verify with ssh-add -L) or complain about wrong permissions. (In case no agent is running in the first place, you can start one with 'ssh-agent bash'.)

    After adding the key to the agent, the agent will take care of authentication and also your git should be able to connect without problems. :)

提交回复
热议问题