git config --global在哪里写入? [英] Where does git config --global get written to?
问题描述
当使用 git config --global
来设置时,它会写入哪个文件?
例子:
git config --global core.editorblah
我在这些地方找不到它:
C:\ Program Files \Git\etc\gitconfig
C:\myapp\.git\config
我还没有设置ENV?
我的Git版本:1.6.5.1.1367.gcd48 -
在Windows 7上更新2016:使用git 2.8(2016年3月),您可以简单地使用:
git config --list --show-origin
您将看到哪个配置设置在哪里。
请参阅哪里设置在我的Git配置来自?
由于 Steven Vascellaro 在评论中指出了 , p>
它可以与非标准安装位置一起使用。 (即 Git Portable )
(如最新的 PortableGit-2.14.2-64-bit.7z.exe
,其中可以在任何你想要的地方进行解压缩)
原始答案(2010)
从文档:
- global
写入选项:写入全局
〜/ .gitconfig
文件而不是存储库.git / config
。
'使用 Git for Windows ,它可能并不清楚这对应的位置。但是如果你看看etc / profile(在 C:\ Program Files \Git
),你会看到:
$ b $ 含义:
C:\Users\MyLogin
(在Windows 7上)
这意味着该文件位于 C: \ Users \MyLogin\.gitconfig
,适用于Windows 7中的Git。
When using git config --global
to set things up, to which file will it write?
Example:
git config --global core.editor "blah"
I can't find it at these places:
C:\Program Files\Git\etc\gitconfig
C:\myapp\.git\config
I have not set an ENV?
My Git version: 1.6.5.1.1367.gcd48 – on Windows 7
Update 2016: with git 2.8 (March 2016), you can simply use:
git config --list --show-origin
You will see which config is set where.
See "Where do the settings in my Git configuration come from?"
As Steven Vascellaro points out in the comments,
it will work with non-standard install locations. (i.e. Git Portable)
(like the latest PortableGit-2.14.2-64-bit.7z.exe
, which can be uncompressed anywhere you want)
Original answer (2010)
From the docs:
--global
For writing options: write to global
~/.gitconfig
file rather than the repository.git/config
.
Since you're using Git for Windows, it may not be clear what location this corresponds to. But if you look at etc/profile (in C:\Program Files\Git
), you'll see:
HOME="$HOMEDRIVE$HOMEPATH"
Meaning:
C:\Users\MyLogin
(on Windows 7)
That means the file is in C:\Users\MyLogin\.gitconfig
for Git in Windows 7.
这篇关于git config --global在哪里写入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!