PHP: エラー「failed to push some refs to '[...]'」の対処
このドキュメントははじめにガイドの一部です。完全なガイドはこちらからご覧いただけます:StackheroでPHPを始める方法。
👋 Stackheroドキュメントへようこそ!
Stackheroは、高速かつ信頼性の高いデプロイを実現する PHPクラウド プラットフォームを提供しています:
- シンプルな
git pushだけで、PHPアプリケーションを数秒で本番環境にデプロイできます。- ご自身のドメインを利用可能で、自動HTTPS証明書が設定されます。手動での作業は一切不要です。
- 自動バックアップ、ワンクリックアップデート、明確で予測可能な料金体系をご利用いただけます。Stackheroがこれらの運用を担当するため、コード開発に集中できます。
- アプリケーション専用に構築されたプライベートかつ専用インフラ上で、高いパフォーマンスとセキュリティを実現します。
ワークフローを効率化し、時間を節約しましょう。 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