2016 年更新:使用 git 2.8(2016 年 3 月),您可以简单地使用:
git config --list --show-origin
借助 Git 2.26(2020 年第一季度),您可以add a --show-scope option https://stackoverflow.com/a/60286340/6309
git config --list --show-origin --show-scope
您将看到哪个配置设置在哪里。
See "我的 Git 配置中的设置来自哪里? https://stackoverflow.com/a/35670933/6309"
As 斯特沃伊夏克 https://stackoverflow.com/users/3357935/stevoisiak指出在评论中 https://stackoverflow.com/questions/2114111/where-does-git-config-global-get-written-to/2115116#comment79861204_2115116,
它将适用于非标准安装位置。 (IE。Git 便携式 https://github.com/git-for-windows/git/releases)
(比如最新的PortableGit-2.14.2-64-bit.7z.exe https://github.com/git-for-windows/git/releases/download/v2.14.2.windows.1/PortableGit-2.14.2-64-bit.7z.exe,可以在任何你想要的地方解压缩)
原始答案(2010)
From the docs http://git-scm.com/docs/git-config:
--global
对于写入选项:写入全局~/.gitconfig
文件而不是存储库.git/config
.
既然你正在使用适用于 Windows 的 Git http://msysgit.github.io/,可能不清楚这个对应的是哪个位置。但是如果你看一下etc/profile(在C:\Program Files\Git
), 你会看到的:
HOME="$HOMEDRIVE$HOMEPATH"
Meaning:
C:\Users\MyLogin
(在 Windows 7 上)
这意味着该文件位于C:\Users\MyLogin\.gitconfig
适用于 Windows 7 中的 Git。