git push heroku master permission denied

前端 未结 7 1971
有刺的猬
有刺的猬 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:40

    on OSX, I was having experiencing the same issue, I was getting

    no such identity: /Users/me/.ssh/yourPrivateKey: No such file or directory
    Permission denied (publickey).
    fatal: Could not read from remote repository.
    
    Please make sure you have the correct access rights
    and the repository exists.
    

    I tried to create a new key with ssh-keygen -t rsa then adding it with heroku keys:add, but it didn't help.

    Then I found a file named config in ~/.ssh/, and inside the file there was:

    ServerAliveInterval 300
    ServerAliveCountMax 3
    
    host heroku.com
        user git
        hostname heroku.com
        identityfile ~/.ssh/yourPrivateKey
    

    So I changed yourPrivateKey to my private key filename (id_rsa by default) aaand it worked :)

提交回复
热议问题