为什么`git clone`会覆盖Windows上的全局core.symlinks?

问题描述 投票:0回答:2

即使我将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

为什么会这样?

windows git symlink
2个回答
0
投票

这是因为我没有启用Developer Mode,因此git在没有管理员特权的情况下无法创建符号链接。启用它可以使以后的克隆获得正确的符号链接。


0
投票

[core.symlinks抱歉,在Windows的Git中过载。

如果在创建存储库时将core.symlinks设置为true(无论是通过运行git init还是git clone),那么git实际上将尝试检测所创建的工作目录中是否支持符号链接,如果是这样,它将then将存储库的core.symlinks设置为true。

如果支持(例如,因为您未启用开发人员模式),则存储库的core.symlinks配置选项将设置为false

因此,第一个选项用作可以指定是否需要符号链接的机制。第二个行为就像是平台上是否支持符号链接的缓存,因此它不需要在每次操作期间都检测到它(很像core.ignorecase)。

© www.soinside.com 2019 - 2024. All rights reserved.