git 找不到全局 .gitconfig 文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/39670247/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Can't Find Global .gitconfig FIle
提问by sdoca
I was trying to make some updates to my global .gitconfig file on my Windows 7 machine. I have Git installed via the https://git-scm.com/for Windows. The file was located at C:\Users\MyName\.gitconfig
, but when I ran some commands, the file wasn't updated.
我试图对我的 Windows 7 机器上的全局 .gitconfig 文件进行一些更新。我已经通过Windows的https://git-scm.com/安装了 Git 。该文件位于C:\Users\MyName\.gitconfig
,但是当我运行一些命令时,该文件没有更新。
I unistalled Git (and removed the user .gitconfig) and reinstalled Git. The install didn't create a C:\Users\MyName\.gitconfig
file. However, if I rungit config --global user.name "My Name"
and do a git config --list
, I see user.name=My Name
in the list of attributes.
我卸载了 Git(并删除了用户 .gitconfig)并重新安装了 Git。安装没有创建C:\Users\MyName\.gitconfig
文件。但是,如果我运行git config --global user.name "My Name"
并执行 a git config --list
,我会user.name=My Name
在属性列表中看到。
I still don't have a .gitconfig file in my user directory nor is there one in C:\Users\MyName\.config\git\
directory.
我的用户目录中仍然没有 .gitconfig 文件,目录中也没有C:\Users\MyName\.config\git\
。
Is there a command to find out where the global config file is?
有没有命令可以找出全局配置文件的位置?
回答by Do Nhu Vy
type:
类型:
git config --list --show-origin
then you will see the location of file .gitconfig
. (The command works on Windows, Mac OS X, Linux)
然后你会看到文件的位置.gitconfig
。(该命令适用于 Windows、Mac OS X、Linux)
回答by merlin2011
Try running the following command see which file is opened in the editor.
尝试运行以下命令查看在编辑器中打开了哪个文件。
git config --global -e