SourceTreeで「error: failed to push some refs to」の対処法
- 作成日 2022.01.04
- SourceTree
- SourceTree
gitのGUIクライアント「error: failed to push some refs to」の対処法を記述してます。
環境
- OS windows10 pro
- git 2.30.1
- SourceTree 3.4.3
エラー全文
プッシュ実行時に発生。
git -c diff.mnemonicprefix=false -c core.quotepath=false --no-optional-locks push -v --tags origin master:master
Pushing to http://xxxxx/testuser/examples.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'http:/xxxxx/testuser/examples.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
エラー終了しました。エラーの内容は上記をご覧ください。
原因
リモートリポジトリにあるファイルと、プッシュしようとしてるファイルが競合しているため
ローカルAリポジトリ(変更したhoge.txt) → リモートにプッシュ
ローカルBリポジトリ(変更したhoge.txt) → リモートにプッシュ
が原因
対処法
まずは、プルを実行してリモートリポジトリからローカルリポジトリに反映させます。
競合が起こっているので、警告が表示されます。
差分のあるファイルが確認できるので、
以下のように、どちらに合わせて編集後に「インデックスに追加」して、
「コミット」すれば、「プッシュ」が可能になります。
-
前の記事
javascript lodashを使ってオブジェクトのパスを指定してメソッドを実行する 2022.01.04
-
次の記事
MySQL json同士のkeyとvalueを比較する 2022.01.04
コメントを書く