首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >为什么‘global’覆盖core.symlinks上的全局?

为什么‘global’覆盖core.symlinks上的全局?
EN

Stack Overflow用户
提问于 2019-10-28 07:24:07
回答 2查看 971关注 0票数 0

我发现git clone默认将本地core.symlinks值设置为false,即使将core.symlinks设置为true

代码语言:javascript
运行
复制
> 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

这一切为什么要发生?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2019-10-28 07:34:38

这是因为我没有启用开发模式,因此git无法在没有管理权限的情况下创建符号链接。使其能够使未来的克隆人获得适当的符号链接。

票数 1
EN

Stack Overflow用户

发布于 2019-10-28 11:14:34

遗憾的是,core.symlinks在Git中超载。

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

如果不支持它们(例如,您没有启用开发人员模式),那么存储库的core.symlinks配置选项将被设置为false

因此,第一个选项作为一种机制,您可以指定是否需要符号链接。第二个操作类似于平台上是否支持符号链接的缓存,这样它就不需要在每次操作中都检测到这一点(就像core.ignorecase一样)。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58587005

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档