我只是想连接到我的GitHub账户。当我这样做的时候,我得到这个错误消息作为一个小红色弹出在页面的右上角:

无法检索项目,内部服务器错误。


当前回答

我也有同样的问题。我已经安装了cli。

git remote

输出:

heroku
origin

git remote -v

输出:

heroku  https://git.heroku.com/YOUR-APP.git (fetch)
heroku  https://git.heroku.com/YOUR-APP.git (push)
origin  https://github.com/GitUserName/yourRepo.git (fetch)
origin  https://github.com/GitUserName/yourRepo.git (push)

如果您的分支名为main,请使用Git分支进行验证。例如,你会这样做:

git push heroku main

对我来说是

git push heroku master

现在推动您的本地更改

git push heroku master

输出:

To https://git.heroku.com/YOUR-APP.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://git.heroku.com/YOUR-APP.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

我不在乎它和遥控器有什么不同。我一直在本地开发,并没有意识到自动Git部署已经失败了。我关心的是局部的变化:

git push heroku master -f

现在部署的应用程序正按预期工作。

其他回答

我使用的是2014年macOS 11.6.5 (Big Sur)版本的MacBook Pro

brew tap heroku/brew && brew install heroku

我得到一个错误和消息更新到最新的Xcode。最新的Xcode需要最新的macOS,而我无法升级到最新的macOS(我需要2015年的MacBook Pro或更新的版本)。对于一台2014年的MacBook Pro,我能够安装Xcode_13.2.1。Xip,并能够运行。现在我可以向Heroku推送最新消息了。

brew tap heroku/brew && brew install heroku

我也有同样的问题。我已经安装了cli。

git remote

输出:

heroku
origin

git remote -v

输出:

heroku  https://git.heroku.com/YOUR-APP.git (fetch)
heroku  https://git.heroku.com/YOUR-APP.git (push)
origin  https://github.com/GitUserName/yourRepo.git (fetch)
origin  https://github.com/GitUserName/yourRepo.git (push)

如果您的分支名为main,请使用Git分支进行验证。例如,你会这样做:

git push heroku main

对我来说是

git push heroku master

现在推动您的本地更改

git push heroku master

输出:

To https://git.heroku.com/YOUR-APP.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://git.heroku.com/YOUR-APP.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

我不在乎它和遥控器有什么不同。我一直在本地开发,并没有意识到自动Git部署已经失败了。我关心的是局部的变化:

git push heroku master -f

现在部署的应用程序正按预期工作。

恩里克·阿隆的答案是为当地的机器工作。

对于远程SSH服务器,将会出现IP不匹配错误。

解决方法:

登录Heroku网站 转到帐户设置 在面板中显示API键 在服务器的命令行中输入heroku login -i 输入电子邮件,使用API密钥作为密码,然后就可以执行Git远程推送的其余步骤了

我也遇到了同样的情况,正如其他人所说,这是由于Heroku的安全问题。同时,您可以使用Heroku CLI部署您的代码。

所以,在Heroku web仪表板上,选择Heroku Git:

然后用Heroku登录设置Heroku CLI。

最后,如果你的存储库已经存在于GitHub上,你需要通过运行以下命令添加一个新的远程:

heroku git:remote -a your_app_name
git push heroku master

您可以在官方文档中找到关于此解决方案的更多信息。

这只是一个暂时的事情,关于这个问题的更多细节在这里。

你可以同时推送到GitHub和Heroku,以获得临时解决方案:

git push -u origin <branch>
git push heroku <branch>