PHP: 处理 "failed to push some refs to '[...]'" 错误
本文件是入门指南指南的一部分。您可以在这里查看完整指南:如何在 Stackhero 上快速开始使用 PHP。
👋 欢迎来到 Stackhero 文档!
Stackhero 提供了一个专为快速、可靠部署而设计的 PHP cloud 平台:
- 只需简单的
git push,即可将您的 PHP 应用快速部署到生产环境。- 支持自定义域名,自动为您配置 HTTPS 证书,无需手动操作。
- 依靠自动备份、一键更新以及清晰、可预测的定价。Stackhero 会为您处理这些细节,让您专注于代码开发。
- 享受专为您的应用打造的高性能与高安全性的私有专用基础设施。
让您的工作流程更顺畅,节省宝贵时间。只需几分钟即可开始体验 Stackhero 的 PHP cloud hosting。
如果部署时遇到如下错误:
error: failed to push some refs to '[...]'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
这表示远程 Git 仓库有您本地没有的更改。如果您确定要用本地版本覆盖远程内容,可以强制推送:
git push -f stackhero main