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 push -f stackhero main