在Windows上的Git 2.6.3上,为什么这个命令会导致:
git config --list
Run Code Online (Sandbox Code Playgroud)
和其他人不一样:
git config --list --system
git config --list --global
git config --list --local
Run Code Online (Sandbox Code Playgroud)
第一个列出的选项多于其他选项的总和.我已经重定向到文件和kdiff比较,并且存在差异.
根据要求,这是git config --list
系统/全局/本地分组中的值而不是:
core.symlinks=false
core.autocrlf=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
pack.packsizelimit=2g
help.format=html
http.sslcainfo=C:/Program Files (x86)/Git/mingw32/ssl/certs/ca-bundle.crt
sendemail.smtpserver=/bin/msmtp.exe
diff.astextplain.textconv=astextplain
rebase.autosquash=true
Run Code Online (Sandbox Code Playgroud)
上面引用的配置(不在系统/全局/本地)值保存在哪里?
Von*_*onC 17
TL; DR : C:\Users\All Users\Git\config
.
请参阅git-for-windows PR 470
在Windows上,由于没有中央
/etc/
目录,还有另一个配置文件(位于%PROGRAMDATA%\Git\config
),旨在包含机器上运行的所有 Git相关软件的设置.
因此,此配置文件的优先级甚至低于$(prefix)/etc/gitconfig
文件.
您可以通过输入来检查(使用git 2.8 +,2016年3月)
git config --list --show-origin
Run Code Online (Sandbox Code Playgroud)
请参阅" 我的Git配置中的设置来自哪里? "
如git config
FILES中所述,git在3个位置(git repo本身之外)查找配置的值(或未找到的默认值)
$(prefix)/etc/gitconfig
Run Code Online (Sandbox Code Playgroud)
系统范围的配置文件.
$XDG_CONFIG_HOME/git/config
Run Code Online (Sandbox Code Playgroud)
第二个特定于用户的配置文件.
如果$XDG_CONFIG_HOME
未设置或为空,$HOME/.config/git/config
将使用.此文件中设置的任何单值变量都将被其中的任何内容覆盖~/.gitconfig
.如果您有时使用旧版本的Git,最好不要创建此文件,因为最近添加了对此文件的支持.
~/.gitconfig
Run Code Online (Sandbox Code Playgroud)
用户特定的配置文件.也称为"全局"配置文件.
但是一个快速的进程监视器提到了第四名(再次,在git repo本身之外)
在C:\ProgramData\Git
,我看到额外的价值观:
C:\ProgramData\Git>more config
[core]
symlinks = false
autocrlf = true
[color]
diff = auto
status = auto
branch = auto
interactive = true
[pack]
packSizeLimit = 2g
[help]
format = html
[http]
sslCAInfo = C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
[sendemail]
smtpserver = /bin/msmtp.exe
[diff "astextplain"]
textconv = astextplain
[rebase]
autosquash = true
Run Code Online (Sandbox Code Playgroud)
如" Windows中文件夹的重要性是什么ProgramData
? "中所述,该文件夹来自All Users
:
C:\Users\All Users\Git>dir
Volume in drive C has no label.
Directory of C:\Users\All Users\Git
23/10/2015 16:36 <DIR> .
23/10/2015 16:36 <DIR> ..
23/10/2015 16:36 350 config
Run Code Online (Sandbox Code Playgroud)