当使用git config --global
进行设置时,它会写入哪个文件?
例:
git config --global core.editor "blah"
我在这些地方找不到它:
C:\Program Files\Git\etc\gitconfig
C:\myapp\.git\config
我还没有设置ENV?
我的Git版本:1.6.5.1.1367.gcd48 - 在Windows 7上
#1楼
注意(对于* nix平台)可能有用:某些类型的全局git配置/信息存储在/usr/share/git-core/
,例如git自动完成脚本和以下(默认)挂钩:
- applypatch-MSG
- 更新后的
- 预提交
- 准备提交-MSG
- 提交-MSG
- 预applypatch
- 前底垫
- 更新
其中的每一个都可以包含它们自己的一组命令,在它们各自的文件名描述的时间执行。
#2楼
我也在我的Windows机器上寻找全局.gitconfig
,并使用git找到了这个巧妙的技巧。
做一个: git config --global -e
然后,如果幸运的话,你会得到一个加载了你的全局.gitconfig
文件的文本编辑器。 只需从那里查找文件夹(或尝试另存为...),等等! :-)
#3楼
在* nixes上,它位于~/.gitconfig
。 你家里有相应的档案吗?
在Windows上,您可以输入git bash
notepad ~/.gitconfig
#4楼
msysgit的路径是:
Windows XP - C:\\Documents and Settings\\<user_name>\\.gitconfig
Windows Vista + C:\\Users\\<user_name>\\.gitconfig
#5楼
2016年更新:使用git 2。8(2016年3月),您可以简单地使用:
git config --list --show-origin
您将看到哪个配置设置在哪里。
请参阅“