即使我将git clone
设置为core.symlinks
,我也发现false
默认将本地core.symlinks
值设置为true
。
> git config --list --show-origin
file:"C:\\ProgramData/Git/config" core.symlinks=true
file:"C:\\ProgramData/Git/config" core.autocrlf=input
file:"C:\\ProgramData/Git/config" core.fscache=true
file:"C:\\ProgramData/Git/config" color.diff=auto
file:"C:\\ProgramData/Git/config" color.status=auto
file:"C:\\ProgramData/Git/config" color.branch=auto
file:"C:\\ProgramData/Git/config" color.interactive=true
file:"C:\\ProgramData/Git/config" help.format=html
file:"C:\\ProgramData/Git/config" rebase.autosquash=true
-- snip --
> cat .git/config
[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
[remote "origin"]
url = https://github.com/saschanaz/eslint-plugin-import
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
为什么会这样?
这是因为我没有启用Developer Mode,因此git在没有管理员特权的情况下无法创建符号链接。启用它可以使以后的克隆获得正确的符号链接。
[core.symlinks
抱歉,在Windows的Git中过载。
如果在创建存储库时将core.symlinks
设置为true
(无论是通过运行git init
还是git clone
),那么git实际上将尝试检测所创建的工作目录中是否支持符号链接,如果是这样,它将then将存储库的core.symlinks
设置为true。
如果支持不(例如,因为您未启用开发人员模式),则存储库的core.symlinks
配置选项将设置为false
。
因此,第一个选项用作可以指定是否需要符号链接的机制。第二个行为就像是平台上是否支持符号链接的缓存,因此它不需要在每次操作期间都检测到它(很像core.ignorecase
)。