GIT 第23章 Git2.x中git push时遇到push.default警告的解决方法 GIT 第23章 Git2.x中git push时遇到push.default警告的解决方法

2023-07-27

一、问题

最近在使用 git&GitHub,然后今天遇到了一个问题。在执行 git add 和 git commit 操作之后,再进行 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)

警告:push.default (默认push)未设置;在Git 2.0 中,push.default 的值从‘matching’改为‘simple’了。消除此警告并保留以前的习惯,输入:

git config --global push.default matching

消除此警告并采用新的设置值,输入:

git config --global push.default simple

当 push.default 的值设置成 ‘matching’ ,git 将会推送所有本地已存在的同名分支到远程仓库 从 Git 2.0 开始,git 采用更加保守的值'simple',只会推送当前分支到相应的远程仓库,'git pull' 也将值更新当前分支。 

二、解决

已经说的很清楚了,Git 2.0 需要设置 push.default 的值,两者的区别上面也说了,所以我就采用新的保守值吧,输入:

git config --global push.default simple

打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,你说多少就多少

打开微信扫一扫,即可进行扫码打赏哦

阅读 245