PHP: 处理 "failed to push some refs to '[...]'" 错误
本文档属于快速入门指南的一部分。您可以在此处查看完整指南:如何在 Stackhero 上开始使用 PHP。
👋 欢迎查阅 Stackhero 文档!
Stackhero 提供托管型 PHP 服务,专为快速、可靠的部署而设计:
- 只需一次简单的
git push,即可将您的 PHP 应用秒级部署到生产环境。- 支持自定义域名,自动为您配置 HTTPS 证书,无需任何手动操作。
- 享受自动备份、一键升级以及清晰透明的定价。Stackhero 为您处理这些细节,让您专注于代码开发。
- 基于专为您的应用打造的私有专属基础设施,保障高性能与高安全性。
让您的开发流程更高效,节省宝贵时间。 只需几分钟,即可开始体验 Stackhero 针对 Laravel 和 Symfony 的 PHP 托管服务。
如果部署时遇到如下错误:
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