git config:“remote.origin.push” vs“push.default” [英] git config: "remote.origin.push" vs "push.default"

查看:872
本文介绍了git config:“remote.origin.push” vs“push.default”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面的命令如何:

  git config remote.origin.push refs / heads / master:refs / heads / master 

与以下命令相关:

  git config push.default< option> 

(与 - local - 全球选项)



其中< option> 是以下之一:

  nothing 
匹配
上游(以前跟踪)
当前
简单



I认为我理解第二个配置命令,但我不明白第一个命令是如何涉及第二个命令的。以下是一些提供此问题背景的参考资料:




  git push origin ... $ b 

$ b

无论在 remote.origin.push 中覆盖无论在 push.default 中设置。更一般地说,如果没有设置 remote。 name .push (这里 name origin ),那么git会回到 push.default ,然后如果这也不是设置,它会回到你的链接中描述的内置默认设置。



请注意:

  git config --local na.me value 

表示相同没有 - 本地。当设置值(如这里) - 本地 - 全局 - -file filename 选项控制设置值的位置,但 - local 是默认值。



(提取值时:

  git config na.me 

[或 git config --get git config --get-all git config --get-regexp ], - local code>等选项限制git读取的地方,没有一个从所有读取它们,如果设置了某些内容,则使用最本地覆盖较少本地不止一个地方。)


How does the following command:

git config remote.origin.push refs/heads/master:refs/heads/master

relate to the following command:

git config push.default <option>

(either with the --local or --global option)

where <option> is one of:

nothing
matching
upstream (formerly tracking)
current
simple

?

I think I understand the second config command, but I don't understand how the first command conditions/relates to the second. Here are some references that provide context behind this question:

解决方案

When you run:

git push origin ...

whatever is set in remote.origin.push overrides whatever is set in push.default. More generally, if remote.name.push is not set (here name is origin), git falls back on push.default, and then if that is also not set, it falls back on the built-in defaults as described in your links.

Note that:

git config --local na.me value

means the same thing as without --local. When setting values (as here) the --local, --global, and --file filename options control where the value is set, but --local is the default.

(When fetching values:

git config na.me

[or git config --get or git config --get-all or git config --get-regexp], the --local, etc, options restrict where git will read from, and without one it reads from all of them, with the "most local" overriding a "less local" if something is set in more than one place.)

这篇关于git config:“remote.origin.push” vs“push.default”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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