PHP: 处理 "failed to push some refs to '[...]'" 错误
本文件是入门指南指南的一部分。您可以在这里查看完整指南:如何在 Stackhero 上快速开始使用 PHP。
👋 欢迎来到 Stackhero 文档!
Stackhero 提供现成的 PHP 云 解决方案,具有多种优势,包括:
- 通过简单的
git push在几秒钟内 部署您的应用程序。- 使用您自己的域名,并享受 HTTPS 证书的自动配置以增强安全性。
- 享受自动备份、一键更新以及简单、透明和可预测的定价带来的安心。
- 通过私有和专用的 VM获得最佳的性能和强大的安全性。
节省时间并简化您的生活:只需 5 分钟即可试用 Stackhero 的 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