当你在Windows上为git设置全局配置选项时,它写在哪里? [英] When you set a global configuration option for git on Windows, where does it get written to?

查看:771
本文介绍了当你在Windows上为git设置全局配置选项时,它写在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果您在Windows上设置类似的操作:

  git config --global core.autocrlf false 

这个全局设置在哪里写入?

解决方案

它会将值写入一个名为.gitconfig的文件中,除非您指定另一个名称带有 - 文件'选项

  git config --global --file myFile键值

注意:环境变量 GIT_CONFIG 也可以用于为此文件指定另一个名称。 - file 将取代GIT_CONFIG值。



无论名称如何,


  • $ HOME for Unix

  • Windows的%HOMEPATH%(默认情况下为c:\Users \MyName)



如果未正确设置$ HOME或%HOMEPATH%, git config 命令将失败。



它用于存储每个用户的配置,并作为repository-local' .git / config '文件。


If you set something like this on Windows:

git config --global core.autocrlf false

Where is this global setting getting written to?

解决方案

It will write the values in a file called .gitconfig, unless you specify another name with the '--file' option

 git config --global --file myFile key value

Note: the environment variable GIT_CONFIG can also be used to specify another name for this file. --file will supersede GIT_CONFIG value.

Whatever its name, it will write it in:

  • $HOME for Unix
  • %HOMEPATH% for Windows (c:\Users\MyName by default)

If $HOME or %HOMEPATH% is not properly set, the git config command will fail.

It is used to store a per-user configuration and serves as fallback values for the repository-local '.git/config' file.

这篇关于当你在Windows上为git设置全局配置选项时,它写在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆