搜索

首页  >  问答  >  正文

git - 警告:push.default 未设置,简单还是匹配?

使用git push 到远程,可却提示这个报错 warning: push.default is unset
是选择 simple 还是 matching ?

ben:basic sl$ git push
warning: push.default is unset; its implicit value has changed in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the traditional behavior, use:

  git config --global push.default matching

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

  git config --global push.default simple

When push.default is set to 'matching', git will push local branches
to the remote branches that already exist with the same name.

Since Git 2.0, Git defaults to the more conservative 'simple'
behavior, which only pushes the current branch to the corresponding
remote branch that 'git pull' uses to update the current branch.

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)
曾经蜡笔没有小新曾经蜡笔没有小新2793 天前733

全部回复(1)我来回复

  • 世界只因有你

    世界只因有你2017-05-02 09:26:13

    'matching' 参数是 Git 1.x 的默认行为,其意是如果你执行 git push 但没有指定分支,它将 push 所有你本地的分支到远程仓库中对应匹配的分支。而 Git 2.x 默认的是 simple,意味着执行 git push 没有指定分支时,只有当前分支会被 push 到你使用 git pull 获取的代码。
    根据提示,修改git push的行为,使之不会每次 push 的时候都进行提示
    git config --global push.default matching
    再次执行git push

    回复
    0
  • 取消回复