Git发出push.default警告 [英] Git pulls a push.default warning

查看:113
本文介绍了Git发出push.default警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我将git提交到远程存储库时,出现以下警告:

  clyde-browns-computer-2: bloccit clydiscope $ git commit -m'安装gem faker并生成种子数据'
[seed-data fabb6ea]安装gem faker并生成种子数据
3个文件已更改,26个插入(+),7个删除( - )
clyde-browns-computer-2:bloccit clydiscope $ git checkout master
转换到分支'master'
您的分支是'origin / master'的最新版本。
clyde-browns-computer-2:bloccit clydiscope $ git merge seed-data
更新1811f8b..fabb6ea
快进
Gemfile | 1 +
Gemfile.lock | 3 +++
db / seeds.rb | 29 ++++++++++++++++++++++ -------
3个文件已更改,26个插入(+),7个删除( - )
clyde-browns-computer-2:bloccit clydiscope $ git branch -d seed-data
删除的分支种子数据(是fabb6ea)。
clyde-browns-computer-2:bloccit clydiscope $ git push

警告:push.default未设置;它的隐含价值在

Git 2.0中从'匹配'变为'简单'。要压制此消息
并保持传统行为,请使用:

\ git config --global push.default匹配

若要压制此消息并采用新的行为,使用:

git config --global push.default简单

当push.default设置为'匹配'时,git将推送本地分支
到已存在的具有相同名称的远程分支。

从Git 2.0开始,Git默认使用更保守的'简单'
行为,它只将当前分支推送到'git pull'用于更新的相应
远程分支当前分支。

为了解决问题,我切换到默认匹配,但我想知道是否有人可以详细说明这意味着,以及这种事情是如何发生的。我开始使用Git 2.0,那么这怎么适用于我?解释方案

它意味着默认情况下,Git只推送当前只有当远程分支中存在同名的远程分支。



这就是为什么在这种默认模式下,第一次推送必须是明确的

  git push -u origin master 

在您的情况下, master 已经有一个上游分支,所以 git push 就足够了。

但是由于推送策略并未明确设置,警告会提醒您,默认情况下,只推送当前分支。

请参阅为什么正在推动匹配默认的Git?


When I pushed a git commit to my remote depository, this warning appeared:

clyde-browns-computer-2:bloccit clydiscope$ git commit -m 'Installed gem faker and generated seed    data'
[seed-data fabb6ea] Installed gem faker and generated seed data
 3 files changed, 26 insertions(+), 7 deletions(-)
clyde-browns-computer-2:bloccit clydiscope$ git checkout master
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'.
clyde-browns-computer-2:bloccit clydiscope$ git merge seed-data
Updating 1811f8b..fabb6ea
Fast-forward
Gemfile      |  1 +
Gemfile.lock |  3 +++
db/seeds.rb  | 29 ++++++++++++++++++++++-------
3 files changed, 26 insertions(+), 7 deletions(-)
clyde-browns-computer-2:bloccit clydiscope$ git branch -d seed-data
Deleted branch seed-data (was fabb6ea).
clyde-browns-computer-2:bloccit clydiscope$ 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.

I switched to default matching just to solve the problem, but I was wondering if anybody could elaborate on what this means exactly, and how this type of thing happens. I started on Git 2.0, so how does this apply to me?

解决方案

It means that by default, Git pushes only the current branch, and only if a remote branch of the same name exists in that remote.

That is why, in that default mode, the first push must be an explicit one:

git push -u origin master

In your case, master already had an upstream branch, so git push was enough.

But since the push policy wasn't explicitly set, the warning reminds you that, by default, only the current branch is pushed.
See more at "Why is pushing to matching the default in Git?"

这篇关于Git发出push.default警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆