You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

CLI部署Heroku应用推送代码时出现Heroku Git error报错

Heroku CLI部署Git推送失败排查方案

故障场景

通过CLI执行Git推送部署Heroku应用时触发pre-receive hook declined报错,此前部署流程长期运行正常,故障当日更早时段曾完成成功部署,执行的部署命令及返回报错如下:

$ git push heroku main
Enumerating objects: 46, done.
Counting objects: 100% (46/46), done.  
Delta compression using up to 8 threads
Compressing objects: 100% (31/31), done.
Writing objects: 100% (31/31), 4.62 KiB | 788.00 KiB/s, done.
Total 31 (delta 23), reused 0 (delta 0), pack-reused 0       
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: !       Heroku Git error, please try again shortly.
remote: !       See http://status.heroku.com for current Heroku platform status.
remote: !       If the problem persists, please open a ticket
remote: !       on https://help.heroku.com/tickets/new
remote: !       and provide the Request ID dee02a42-c0d2-4740-b9f3-cbfb58c7d95f
remote: 
To https://git.heroku.com/vaquita-escolar.git
 ! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/vaquita-escolar.git'

该报错明确指向Heroku平台侧Git服务异常,不属于本地代码错误、配置错误导致的构建失败范畴。

排查解决步骤

  • 先等5到10分钟直接重试推送。这个报错是Heroku Git接收层的临时服务波动,你之前部署一直正常、故障当天更早时候还能成功部署,说明本地代码、配置没有问题,短时间重试的恢复概率最高,不需要修改任何本地内容。
  • 单次重试失败的话,先校验本地Heroku登录态与应用权限:执行heroku login重新完成身份认证,再执行heroku apps:info --app vaquita-escolar确认当前账号可正常访问目标应用,排除偶发的鉴权失效问题,校验完成后再次尝试推送。
  • 连续3次以上重试仍失败的,直接带着报错中给出的Request ID dee02a42-c0d2-4740-b9f3-cbfb58c7d95f联系Heroku官方支持,该ID可直接定位本次请求对应的全链路服务端日志,不需要在本地做无意义的排查。
  • 不要做无效操作:不要删除本地仓库重克隆、不要随意回滚历史提交、不要重置Heroku Git远程地址,这类操作对平台侧的服务故障没有任何修复作用,反而可能破坏本地仓库的提交记录。

内容的提问来源于stack exchange,提问作者Daniel Tkach

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.30 11:42:17