PHP: 處理錯誤 "failed to push some refs to '[...]'"
本文件是PHP 快速上手指南指南的一部分。請在此處查看完整指南:如何在 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