当我执行 a 时git config --,我会看到以下(删节的)列表:
$ git config --list
...
core.autocrlf=true
...
core.safecrlf=true
core.autocrlf=true
...
Run Code Online (Sandbox Code Playgroud)
请注意core.autocrlf=true被重复。然后,我尝试将它们的值“全局”设置为 false,并且git config --global core.autocrlf false只有第二个实例发生变化:
$ git config --list
...
core.autocrlf=true
...
core.safecrlf=true
core.autocrlf=false
...
Run Code Online (Sandbox Code Playgroud)
我看到使用--show-origin标志澄清了每个的来源:
file:"C:\\ProgramData/Git/config" core.autocrlf=true
file:C:/Users/schmoejoe/.gitconfig core.autocrlf=true
Run Code Online (Sandbox Code Playgroud)
该答案还指出了优先顺序(本地>全局>系统)。所以我的问题是:有没有办法从命令行更改每个值的值(无论是使用单独的命令还是同时更改所有命令)?
根据文档:
如果未使用 --file 显式设置,则 git config 将在四个文件中搜索配置选项:...
文件按上面给出的顺序读取,最后找到的值优先于先前读取的值。当采用多个值时,将使用所有文件中某个键的所有值。
请注意,您可以通过键入以下内容来获取此文档
git help config
Run Code Online (Sandbox Code Playgroud)
或者通过谷歌搜索“git config”。
| 归档时间: |
|
| 查看次数: |
1380 次 |
| 最近记录: |