git 无法将 master 推送到 heroku

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5136744/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 05:07:38  来源:igfitidea点击:

Unable to push master to heroku

githeroku

提问by sakthig

I'm unable to push use git push in github as well as heroku, i have tried various methods as suggested on this question. pls help to resolve this problem .. i see the following report while i try to push.

我无法在 github 和 heroku 中推送使用 git push,我已经尝试了在这个问题上建议的各种方法。请帮助解决这个问题..当我尝试推送时,我看到了以下报告。

D:\My\weblog>git push heroku master
Permission denied (publickey).
fatal: The remote end hung up unexpectedly

D:\My\weblog>ssh -v [email protected]
OpenSSH_4.6p1, OpenSSL 0.9.8e 23 Feb 2007
debug1: Connecting to heroku.com [50.16.232.130] port 22.
debug1: Connection established.
debug1: identity file /.ssh/identity type -1
debug1: identity file /.ssh/id_rsa type -1
debug1: identity file /.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.1p1 Debia
n-5pgsql1
debug1: match: OpenSSH_5.1p1 Debian-5pgsql1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_4.6
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-cbc hmac-md5 none
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'heroku.com' is known and matches the RSA host key.
debug1: Found key in /.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /.ssh/identity
debug1: Trying private key: /.ssh/id_rsa
debug1: Trying private key: /.ssh/id_dsa
debug1: No more authentication methods to try.
Permission denied (publickey).

Am using windows 7 .

我正在使用 Windows 7。

回答by Harshit Pandey

type in gem install heroku

输入 gem install heroku

Then upload rsa key of github to heroku

然后将github的rsa key上传到heroku

$ heroku keys:add
Uploading ssh public key /Users/adam/.ssh/id_rsa.pub

Once you key in configured with heroku and github with command all your code goes to github and from there to Heroku

一旦你用命令输入了 heroku 和 github 的配置,你的所有代码都会转到 github 并从那里转到 Heroku

git push heroku master 

and soon you will see these messages

很快你就会看到这些消息

-----> Heroku receiving push
-----> Ruby/Rails app detected
-----> Detected Rails is not set to serve static_assets

回答by Andrew Marshall

It looks like heroku isn't accepting your machine's public keys. Be sure that you've given your public key to heroku. Heroku's guide on SSH keysshould help.

看起来 heroku 不接受您机器的公钥。确保您已将公钥提供给 heroku。Heroku 的 SSH 密钥指南应该会有所帮助。

回答by rustybrain

回答by sksizer

I ran into a similar issue on OSX with heroku-toolbelt/2.32.8. Even after following heroku I was unsuccessful until I used a key in the default path - IE ~/.ssh/id_rsa.pub.

我在使用 heroku-toolbelt/2.32.8 的 OSX 上遇到了类似的问题。即使在遵循 heroku 之后,我也没有成功,直到我在默认路径中使用了一个密钥 - IE ~/.ssh/id_rsa.pub。

回答by user1592832

I had the same issue - turns out I forgot that Windows 8 doesn't start the command prompt with admin privileges by default like Windows 7 did. Running it as administrator fixed my issue.

我遇到了同样的问题 - 结果我忘记了 Windows 8 默认情况下不会像 Windows 7 那样以管理员权限启动命令提示符。以管理员身份运行它解决了我的问题。

回答by Saed Mansour

On ubuntu sudo susolved it for me.

在 ubuntu 上sudo su为我解决了这个问题。

When I used ssh to generate the key, then if you read the contents of "id_rsa.pub" there's a username at the end of the file. For me it was "root@pc-name", but without sudo suthe current username is "username@pc-name" instead of "root@pc-name". sudo susolves that by switching to "root@pc-name".

当我使用 ssh 生成密钥时,如果您阅读“id_rsa.pub”的内容,文件末尾会有一个用户名。对我来说是“root@pc-name”,但没有sudo su当前用户名的是“username@pc-name”而不是“root@pc-name”。sudo su通过切换到“root@pc-name”来解决这个问题。

回答by FluffyBeing

If using Windows and Cygwin, I had to start Cygwin with admin privileges before it would let me push to Heroku.

如果使用 Windows 和 Cygwin,我必须以管理员权限启动 Cygwin,然后它才能让我推送到 Heroku。

回答by angel

I faced the same problem. I solved it with change cmd command with Git Bash. Do everything on Git.

我遇到了同样的问题。我用 Git Bash 用 change cmd 命令解决了这个问题。在 Git 上做所有事情。