【问题标题】:How to fix "error: src refspec master does not match any" error when pushing to Heroku?推送到 Heroku 时如何修复“错误:src refspec master 不匹配任何”错误?
【发布时间】:2018-05-30 07:33:25
【问题描述】:

我无法将 master 推送到 Heroku 以部署我的 Heroku 应用程序。

当我输入这段代码时:

git push heroku master

我收到此错误:

error: src refspec master does not match any.
error: failed to push some refs to 'git@heroku.com:evening-scrubland-91960.git'

git@heroku.com:evening-scrubland-91960.git 是我的应用程序的名称。

如果有帮助,我将使用此网站作为教程: https://devcenter.heroku.com/articles/getting-started-with-python#deploy-the-app

我还使用了以下网站的以下建议: I want make push and get error: src refspec master does not match any

【问题讨论】:

    标签: git heroku


    【解决方案1】:

    如果您仍在使用“master”而不是“main”,您也可能会收到上述错误。

    代替: “git push heroku master”

    试试: “git push heroku main”

    【讨论】:

    • 这只是对分支命名约定的猜测。它是 github 官方的,但 git 和 github 是完全不同的东西
    • @GTsvetanov heroku 也将 master 更改为 main。所以,这个答案适用于包括我在内的数十人:)
    【解决方案2】:

    日志告诉你一切: src refspec master does not match any 表示 master 分支上还没有提交任何内容

    请确保您已使用git add 命令暂存更改并使用git commit 命令提交更改 将它们推送到远程。

    【讨论】:

    • 我将什么传递给 git add? $ git add heroku // 致命:pathspec 'heroku' 不匹配任何文件
    猜你喜欢
    • 2014-02-11
    • 2023-01-30
    • 2012-05-21
    • 2011-08-13
    • 2012-09-09
    • 2017-03-05
    • 2018-01-28
    • 2013-03-28
    相关资源
    最近更新 更多