跟进Is it possible to include a file in your .gitconfig,在.gitconfig文件中使用include有什么例外吗?为什么我的不能用了?

$ cat .gitconfig
[include]
    path = /tmp/.gitconfig.id

$ cat /tmp/.gitconfig.id

[user]
        name = Me
        email = my@my.place.com

$ git config --global user.name | wc
      0       0       0

$ git -v
git version 2.39.2

$ uname -rms
Linux 6.1.0-9-amd64 x86_64

$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 12 (bookworm)
Release:        12
Codename:       bookworm

也就是说,我发现自己可以用.gitconfig中的include来表示allexcept[user]节.

推荐答案

--[no-]includes:

在查找值时,请遵守配置文件中的include.*条指令.当给定特定文件时(例如,使用--file--global等)默认为off,搜索所有配置文件时默认为on.

即省略--global:

git config user.name | wc

或加--includes:

git config --global --includes user.name | wc

Linux相关问答推荐

GNC C:关于主要出发点混乱的 idea ?

如何在REPL控制台中使用PowerShell将特定的CSV列转换为TitleCase?

使用 ansible 验证 firewalld 配置

如何在充满 csv 的目录中获得不同的值计数

可以用openmp并行化内存分配删除吗? (c++)

构建 python 映像时 Docker compose 问题,访问被拒绝或存储库不存在

在 linux 中插入带有 sed 命令的文件的行

读取命令停止执行 bash 脚本

Stripping linux 共享库

为什么 fork() 在 setsid() 之前

/usr/local/bin/ 中Collection的权限被拒绝

GLIBCXX 版本

仅当当前行中存在字符串时才替换

命令列出除 . (点)和..(点点)

/var 中有什么?

如何等待第一个命令完成?

Linux:用户名不在 sudoers 文件中

Linux SCHED_OTHER、SCHED_FIFO 和 SCHED_RR - 区别

PostgreSQL psql 终端命令

为嵌入式 Linux 设备实施更新/升级系统