升级heroku堆栈后无法重新部署应用程序

cotxawn7  于 2022-11-13  发布在  其他
关注(0)|答案(1)|浏览(126)

我们正在将heroku堆栈从18升级到22。当我们尝试重新部署应用程序时,点击升级后,我们在执行git推送时收到以下错误:

error: src refspec master does not match any
error: failed to push some refs to 'https://git.heroku.com/test.git'

我们将按照以下步骤进行重新部署:
$ heroku git:克隆-一个测试
$ cd测试
$ git添加。
$ git commit -am“让它更好”
$ git推heroku大师
此外,我们还通过CLI执行了以下步骤
要通过Heroku CLI升级,请在生产应用上使用stack:set命令:
heroku stack:set heroku-22 -a test将stack设置为heroku-22... done您需要重新部署以使更改生效。运行git push heroku main以在上触发一个新的构建。
git commit --allow-empty -m“正在升级到heroku-22”

[master (root-commit) 89fea09] Upgrading to heroku-22

git推动heroku大师

Enumerating objects: 2, done.
Counting objects: 100% (2/2), done.
Writing objects: 100% (2/2), 185 bytes | 185.00 KiB/s, done.
Total 2 (delta 0), reused 0 (delta 0), pack-reused 0
remote: error: pathspec '.' did not match any file(s) known to git.
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:
To https://git.heroku.com/test.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/test.git'
bhattacharjee.c@bhattac-ltmynzq ei-mule-dashboard-ee1 % git push heroku main
error: src refspec main does not match any
error: failed to push some refs to 'https://git.heroku.com/test.git'.

我们在此收到以下错误:

remote: error: pathspec '.' did not match any file(s) known to git.
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

远程:

To https://git.heroku.com/test.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/test.git'
bhattacharjee.c@bhattac-ltmynzq ei-mule-dashboard-ee1 % git push heroku main
error: src refspec main does not match any
error: failed to push some refs to 'https://git.heroku.com/test.git'.

你能帮我们解决这个问题吗?

osh3o9ms

osh3o9ms1#

我们将按照以下步骤进行重新部署:

$ heroku git:clone -a test

首先,you shouldn't be doing this
Heroku应用的Git存储库仅用于部署目的。从该存储库克隆不作为正式支持的功能,应仅作为最后手段尝试。请勿使用该存储库作为应用的规范“源”存储库。请改用您自己的Git服务器或版本控制服务,如GitHub。
如果这是您常规工作流程的一部分,请进行相应调整。Heroku不是源代码管理平台。
现在,进入问题:

src refspec master does not match any

你根本就没有master分支。
Heroku从两个分支之一构建:main(较新,逐渐成为社区标准的默认分支名称)和master(传统)。
如果你没有master分支,你几乎可以肯定有一个main分支,Heroku会很乐意从这个分支中构建:

git push heroku main

如果您需要从其他分支another-branch进行部署,您仍然需要推送到Heroku上的main(或master):

git push heroku another-branch:main

最后,请不要真的用“让它更好”作为提交信息。花点时间让提交信息清晰而有意义。有很多关于如何做到这一点的good advice

相关问题