当使用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上
当使用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上
当前回答
卸载Msysgit,安装Cygwin + Git。然后是global '。C:\cygwin(64)\home\[userName]\。gitconfig。
现在你不必担心可能被其他程序使用的环境变量。例如,我的环境变量将我指向工作windows域环境中的一个映射驱动器。我不希望我的全局。gitconfig位于我的“home”映射驱动器上。我也不知道其他可能依赖于windows环境变量的应用程序会发生什么。由于某种原因,操作部门可能需要将该环境变量设置为映射的驱动器。
此外,你不必担心Mysysgit覆盖你的'配置文件'配置设置,如果你指定一个特定的路径全局'。Gitconfig ',使用这个方法。
一般来说,节省自己,在窗口中使用cygwin bash shell会更快乐
其他回答
可能需要注意的是(对于*nix平台):某些类型的全局git配置/信息存储在/usr/share/git-core/中,例如git自动完成脚本和以下(默认)钩子:
applypatch-msg 后更新 未雨绸缪 prepare-commit-msg commit-msg pre-applypatch pre-rebase 更新
它们中的每一个都可以在各自的文件名所描述的时间包含自己要执行的命令集。
我认为这句话很重要:
Git for Windows supports four levels of configuration. At the lowest level is the machine specific configuration settings known as "portable" and lives a "%ProgramData%\Git\config". One priority level us the installation specific configuration settings known as "system", which live at "\mingw64\etc\gitconfig". Both of these configuration file, generally require elevated privileges to modify. Starting with the use specific values known as "global" configuration, which can be found at "%UserProfile%.gitconfig", we find the "user editable" configuration files. The highest priority configuration settings are in the "local" configuration, which can usually be found at ".git\config". It see the recommendation in the blog linked is to modify the "system" or "installation" specific configuration settings, which is fine but users should expect that other installations of Git would not absorb said settings. If you want machine wide settings, use the "portable" configuration file, otherwise choose the "global" or "local" configuration files. Hopefully, people find this information useful.
源
我也遇到过类似的问题;问题是.gitconfig文件位于
C:\Users\MyLogin\.gitconfig\
(适用于windows7)
换句话说,该文件位于c:\ users \ mylogin \.gitconfig\。而不是c:\ users \ mylogin \。gitconfig(这是Git寻找文件的地方)。
在*nixes上,它在~/.gitconfig中。你家里有相应的文件吗?
在Windows上,你可以输入git bash
notepad ~/.gitconfig
我在Windows 8.1上使用SmartGit和msysgit,并注意到gitconfig文件可以有三个不同的位置:
%USERPROFILE%\.gitconfig
C:\Program Files (x86)\Git\etc\gitconfig
C:\Program Files (x86)\SmartGitHg\git\etc\gitconfig
但是使用的是来自%USERPROFILE%\.gitconfig的。