【问题标题】:How To Fix Miscased Procfile in Heroku如何在 Heroku 中修复错误的 Procfile
【发布时间】:2019-11-29 22:33:20
【问题描述】:

Heroku 不会重新加载我更正后的 Procfile

我运行了 git status,它显示了 Procfile,我意识到我用小写 p 拼写了 Procfile。我看到了错误并更新了项目中的文件名,但是当我再次保存并运行 git status 时,它仍然显示为小写。当然,现在它不会在 Heroku 上显示该网站。

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   procfile
remote: -----> Discovering process types
remote:
remote:  ~     Mis-cased procfile detected; ignoring.
remote:  ~     Rename it to Procfile to have it honored.
remote:
remote:        Procfile declares types -> (none)

我第一个项目的新手。我应该删除 Heroku 上的项目并重新开始,还是可以只执行 git init 然后将所有内容再次推送到 Heroku?

【问题讨论】:

  • “没有为提交暂存的更改”——所以暂存该更改并提交它。如果您想发布对 Heroku 的更改,您需要先提交它们。
  • 我已更正并保存了所有更改两次并尝试提交,但它没有获取对配置文件的更改。 Git 仍然看到“procfile”而不是“Procfile”。我认为删除 Heroku 中的项目并再次运行 git init 会更容易,这样它就可以正确设置所有内容,然后再次运行 heroku create。
  • 您使用的是什么操作系统?
  • 我使用的是 Windows 10。我尝试重新初始化并再次提交,但它仍然在尝试重新提交错误的 procfile。不知道下一步该做什么。
  • 默认情况下,Windows 的文件系统不区分大小写。 Procfileprocfile 在那里是一样的,所以你不能直接将一个重命名为另一个。见stackoverflow.com/a/1793755/354577

标签: python django heroku


【解决方案1】:

这对我有用,

  • 从您的工作项目目录中删除 Procfile
  • 在命令行中

git add -A 将您的更改添加到 git, git commit -m "Removed Procfile", git push heroku master

  • 然后,在您的工作项目目录中创建具有正确大小写的新 Procfile
  • 然后添加、提交并将您的代码推送到 Heroku。完成!

【讨论】:

    【解决方案2】:

    您似乎在 Procfile 的名称中打错了字。但是,如果您重命名文件并运行 git add . 然后运行 ​​git commit 它不会对您的提交进行任何更改。所以你必须从 repo 中移动你的文件并提交另一个提交,例如git add . 然后git commit。完成这些步骤后,您可以再次将 Procfile 移动到您的存储库中,然后再次按上述方式提交。

    【讨论】:

      猜你喜欢
      • 2018-01-09
      • 2012-07-20
      • 2021-10-17
      • 1970-01-01
      • 2020-01-05
      • 2013-07-24
      • 1970-01-01
      • 2015-02-21
      • 2019-12-17
      相关资源
      最近更新 更多