gpt4 book ai didi

ruby-on-rails - 无法将主分支推送到 Git 中的 Heroku

转载 作者:太空宇宙 更新时间:2023-11-03 17:54:15 25 4
gpt4 key购买 nike

我正在合作开展一个项目并从 Github 克隆 repo 协议(protocol),进行一些更改并推送到 Heroku。现在克隆的应用程序的所有 key 和密码都是硬编码的,而不是在 ENV 变量中。

所以我创建了 ENV 变量,将文件添加到 .gitignore。所以这个应用程序在提交历史中仍然有这些键。我现在所做的是让作者在 Github 上创建一个新的存储库,从原始应用程序中删除 .git 文件并将新代码推送到新的存储库。

所以现在我已经克隆了新的应用程序,在 Heroku 应用程序中添加了一个新的 Remote 。

heroku git:remote -a myapplication

我的问题是我无法将新应用推送到现有的 Heroku 应用。当我这样做时,我得到:

error: failed to push some refs to 'git@heroku.com:myapplication.git
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

所以 git pull 说一切都是最新的。

git remote -v 输出

heroku  git@heroku.com:myapplication.git (fetch)
heroku git@heroku.com:myapplication.git (push)
origin git@github.com:author/myapplication.git (fetch)
origin git@github.com:author/myapplication.git (push)

如何将新应用程序推送到现有的 heroku 应用程序?

更新

我跑了

git push -f heroku master

哪个推了但是我有错误

   you have not declared a Ruby version in your Gemfile.
To set your Ruby version add this line to your Gemfile:"
ruby '1.9.2'"

我以前从来不需要指定,现在所有设置的原始配置变量都不再存储在 Heroku 中。

最佳答案

git pull 会默认从 GitHub pull ,它已经有你所有的提交。

您可能需要:

  • git pull heroku
  • 清理文件(如果 merge 带回硬编码值)
  • 推送到
  • 通过 heroku 命令推送到 heroku

关于ruby-on-rails - 无法将主分支推送到 Git 中的 Heroku,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17434739/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com