Humanity

Edit the world by your favorite way

Git 2.0でpush.defaultのデフォルト値がmatchingからsimpleに変わった

push.defaultが.gitconfigで指定されてなくてpush.defaultが参照されるようなコマンド(引数なしのgit pushとか)をした場合にエラーが起きて、以下のようなエラーが出る。

なので厳密にはデフォルト値ではない。
「git push」とかやる時はpush.defaultを必ず.gitconfigで指定しなくてはならない。

自分は「git push remote -v」とかアホなコマンド打った時にこのエラーに出くわした。

$ git push remote -v
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)

Pushing to remote
fatal: 'remote' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

どうやら「push.default = simple」のが安全らしいのでsimpleにした。

$ git config --global push.default simple

追記


タイトルが逆になってたので直した。
@omochimetaruさん指摘ありがとうございます。
誤:Git 2.0でpush.defaultのデフォルト値がsimpleからmatchingに変わった
正:Git 2.0でpush.defaultのデフォルト値がmatchingからsimpleに変わった