使用 git 部署到 Heroku 由于快进而不断被拒绝

发布于 2024-11-27 06:11:30 字数 1040 浏览 1 评论 0原文

我一直在使用heroku + git 时遇到以下失败...

$ heroku jammit:deploy --app XXXXXXXXXXX
===== Compiling assets...[OK]
===== Commiting assets...[OK]
===== Done...
===== Deploying assets for xxxxx-staging to heroku...
To [email protected]:XXXXXXXX.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to '[email protected]:xxx-staging.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again.  See the
'Note about fast-forwards' section of 'git push --help' for details.
[FAIL]
===== Done...
===== Deleting compiled assets...[OK]
===== Commiting deleted assets...[OK]
===== Done...
$ git pull
Already up-to-date.

有什么想法我做错了什么或者应该采取不同的做法以允许推送而不必强制推送吗?

谢谢

I keep getting the following fail with heroku + git...

$ heroku jammit:deploy --app XXXXXXXXXXX
===== Compiling assets...[OK]
===== Commiting assets...[OK]
===== Done...
===== Deploying assets for xxxxx-staging to heroku...
To [email protected]:XXXXXXXX.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to '[email protected]:xxx-staging.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again.  See the
'Note about fast-forwards' section of 'git push --help' for details.
[FAIL]
===== Done...
===== Deleting compiled assets...[OK]
===== Commiting deleted assets...[OK]
===== Done...
$ git pull
Already up-to-date.

Any ideas what I'm doing wrong or should be doing differently to allow for pushing without having to force a push?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

捶死心动 2024-12-04 06:11:31

问题是更改已经被推送,而您的提交落后于这些新的推送。我假设您有一个 master 分支,并且您的功能分支仍然存在,假设它名为 my_feature。你可以这样做并且没问题:

git checkout master
git pull
git checkout my_feature
git rebase master
    (you may have to fix some conflicts here, if any are found)
git checkout master
git merge my_feature
git push heroku

你应该记住运行任何必须的测试以确保一切都很好。

The problem is that changes have already been pushed and your commit is behind those newer pushes. I'm going to assume you have a master branch and your feature branch still, let's say it's called my_feature. You can do this and be okay:

git checkout master
git pull
git checkout my_feature
git rebase master
    (you may have to fix some conflicts here, if any are found)
git checkout master
git merge my_feature
git push heroku

You should remember to run any tests you have to make sure everything's good still.

厌倦 2024-12-04 06:11:30

只要每次推送时强制提交,即使有快进提交,它也会推送。我们一直在开发 Heroku 服务器中执行此操作,因为我们都在推送不同的提交(有些比其他提交更落后)。

git push -f [email protected]:picasso-staging.git

我不使用 jammit 进行部署,但您可能可以先强制推送,然后再运行 jammit 任务。或者检查 jammit 是否支持某种强制推送标志。

Just force the commit every time you push and it will push it even if there are fast-forward commits. We do this in our development Heroku server all the time since we're all pushing different commits (some further behind than others).

git push -f [email protected]:picasso-staging.git

I don't use jammit for deploying, but you could probably get away with force pushing first and then running the jammit task second. Or check and see if jammit supports a force push flag of some sort.

岁吢 2024-12-04 06:11:30
git push -f REMOTE BRANCH:master #or just master

强行!将 REMOTE 替换为您的 heroku 远程名称(git remote -v 以查看所有远程)。将 BRANCH 替换为您要推送的分支,或者仅将“master”作为主分支。

git push -f REMOTE BRANCH:master #or just master

Force it! Replace REMOTE with your heroku remote name (git remote -v to view all remotes). Replace BRANCH with the branch you want to push or just put "master" for the master branch.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文