スポンサーリンク

【Git】エラー「master -> master (non-fast-forward)」と出たときにやったこと

あるときgit pushをすると以下のエラーが表示された

$ git push
warning: push.default is unset; its implicit value is changing in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the current behavior after the default changes, use:

  git config --global push.default matching

To squelch this message and adopt the new behavior now, use:

  git config --global push.default simple

See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)

To http://hoge_user:hoge_password@hoge.ne.jp/scm/hoge/hogehoge.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'http://hoge_user:hoge_password@hoge.ne.jp/scm/hoge/hogehoge.git'
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. If you did not intend to push that branch, you may want to
hint: specify branches to push or set the 'push.default' configuration variable
hint: to 'simple', 'current' or 'upstream' to push only the current branch.
スポンサーリンク

対応

以下の記事を参考

gitの覚え書き(特定branchのpush)

エラー時に出力されたメッセージにもヒントが書いてありますが以下のコマンドを実行して現在開発しているブランチだけpushする

$ git config --global push.default current

他にも「non-fast-forward push」となるパターンがあるみたい

以下のページの情報が役に立つかも

Non-Fast-Forward Push の解決

git pushがrejectされたときの解決方法URLまとめ

コメント

タイトルとURLをコピーしました