使用 git 部署到 Heroku 由于快进而不断被拒绝
我一直在使用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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
问题是更改已经被推送,而您的提交落后于这些新的推送。我假设您有一个 master 分支,并且您的功能分支仍然存在,假设它名为
my_feature
。你可以这样做并且没问题:你应该记住运行任何必须的测试以确保一切都很好。
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:You should remember to run any tests you have to make sure everything's good still.
只要每次推送时强制提交,即使有快进提交,它也会推送。我们一直在开发 Heroku 服务器中执行此操作,因为我们都在推送不同的提交(有些比其他提交更落后)。
我不使用 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).
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.
强行!将 REMOTE 替换为您的 heroku 远程名称(
git remote -v
以查看所有远程)。将 BRANCH 替换为您要推送的分支,或者仅将“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.