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