error: failed to push some refs to 'origin'. Updates were rejected because a pushed branch 'develop' is behind its remote counterpart の原因と解決法
error: failed to push some refs to 'origin'. Updates were rejected because a pushed branch 'develop' is behind its remote counterpart の原因と具体的な解決手順をまとめました。
エラーメッセージ(全文)
error: failed to push some refs to 'origin'. Updates were rejected because a pushed branch 'develop' is behind its remote counterpart
このエラーとは
error: failed to push some refs to 'origin'. Updates were rejected because a pushed branch 'develop' is behind its remote counterpart は Git 開発でよく遭遇するエラーです。
想定環境: Windows / macOS / Linux
よく出る状況: git push origin develop
よくある原因
- リモートに先行コミットあり
- force push 禁止
解決方法
方法1: pull してから push
git pull --rebase origin develop
git pull --rebase origin develop
git push origin develop
それでも直らないとき
バージョン情報(Git のバージョン、OS、実行コマンド)を添えて、エラーメッセージ全文と直前に変更した点を確認してください。ログの数行上にも原因の手がかりが残っていることが多いです。
まとめ
「error: failed to push some refs to 'origin'. Updates were rejected because a pushed branch 'develop' is behind its remote counterpart」は リモートに先行コミットあり が原因のことが多いです。上記の手順で切り分けてください。
次にやること
同じ Git カテゴリの関連エラーもあわせて確認してください。
よくある質問
error: failed to push some refs to 'origin'. Updates were rejected because a … とは何ですか?
error: failed to push some refs to 'origin'. Updates were rejected because a pushed branch 'develop' is behind its remote counterpart は Git 実行時に表示されるエラーです。リモートに先行コミットあり
error: failed to push some refs to 'origin'. Updates were rejected because a … の原因は?
リモートに先行コミットあり。force push 禁止。
error: failed to push some refs to 'origin'. Updates were rejected because a … の直し方は?
pull してから push:git pull --rebase origin develop
Git で error が出るのはなぜ?
git push origin develop
error: failed to push some refs to 'origin'. Updates were rejected because a … を防ぐには?
。
次に読むべき記事
- error: failed to push some refs to 'origin'. Updates were rejected because a pushed branch 'feature/login' is behind its remote counterpart の原因と解決法
- error: failed to push some refs to 'origin'. Updates were rejected because a pushed branch 'release/1.0' is behind its remote counterpart の原因と解決法
- error: failed to push some refs to 'origin'. Updates were rejected because a pushed branch 'hotfix/urgent' is behind its remote counterpart の原因と解決法
- error: failed to push some refs to 'origin'. Updates were rejected because a pushed branch 'master' is behind its remote counterpart の原因と解決法
- error: failed to push some refs to 'origin'. Updates were rejected because a pushed branch 'main' is behind its remote counterpart の原因と解決法
同カテゴリ「Gitエラー」の記事
- error: failed to push some refs to 'origin' (protected branch feature/task-448) の原因と解決法
- error: failed to push some refs to 'origin' (protected branch release/438.0) の原因と解決法
- error: failed to push some refs to 'origin' (protected branch feature/task-428) の原因と解決法
- error: failed to push some refs to 'origin' (protected branch release/418.0) の原因と解決法
- error: failed to push some refs to 'origin' (protected branch feature/task-408) の原因と解決法
- error: failed to push some refs to 'origin' (protected branch release/398.0) の原因と解決法
人気記事
- TS2307: Cannot find module '@components/Widget601' or its corresponding type declarations の原因と解決法
- TS2307: Cannot find module '@components/Widget591' or its corresponding type declarations の原因と解決法
- TS2307: Cannot find module '@components/Widget581' or its corresponding type declarations の原因と解決法
- TS2307: Cannot find module '@components/Widget571' or its corresponding type declarations の原因と解決法
- TS2307: Cannot find module '@components/Widget561' or its corresponding type declarations の原因と解決法
- TS2307: Cannot find module '@components/Widget551' or its corresponding type declarations の原因と解決法
学習ルート
体系的に学びたい方はこちらから。
エラー・トラブル集で続きを探す →あわせて読みたい
- error: failed to push some refs to 'origin'. Updates were rejected because a pushed branch 'hotfix/urgent' is behind its remote counterpart の原因と解決法同カテゴリの関連エラー
- error: failed to push some refs to 'origin'. Updates were rejected because a pushed branch 'release/1.0' is behind its remote counterpart の原因と解決法同カテゴリの関連エラー
- error: failed to push some refs to 'origin'. Updates were rejected because a pushed branch 'feature/login' is behind its remote counterpart の原因と解決法同カテゴリの関連エラー
- error: failed to push some refs to 'origin'. Updates were rejected because a pushed branch 'master' is behind its remote counterpart の原因と解決法同カテゴリの関連エラー
- error: failed to push some refs to 'origin'. Updates were rejected because a pushed branch 'main' is behind its remote counterpart の原因と解決法同カテゴリの関連エラー