I found that git clone
sets local core.symlinks
value as false
by default even when I have set core.symlinks
as 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
Why does this happen?
core.symlinks
is, regrettably, overloaded in Git for Windows.
If you have core.symlinks
set to true
when you create a repository (whether by running git init
or git clone
), then git will actually attempt to detect if symlinks are supported in the working directory you're creating, and if so, it will then set the repository's core.symlinks
to true.
If they are not supported (because, for example, you didn't enable Developer Mode) then the repository's core.symlinks
configuration option will be set to false
.
So the first option serves as a mechanism that you can specify if you want symbolic links. The second acts like a cache of whether symlinks are supported on the platform so that it doesn't need to detect this during every operation (much like core.ignorecase
).
This was because I didn't enable Developer Mode and thus git couldn't create symlinks without admin privilege. Enabling it allows future clones to get proper symlinks.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.