- 系统:读
/etc/gitconfig
该文件。(传递--system
选项) - 全局:查找每个用户的
~/.gitconfig
文件(或者~/.config/git/config
文件)。(传递--global
选项) - 本地:查找工程Git 目录下的配置文件(
.git/config
)。 这个文件中的值只对该版本库有效。
以上三个层次中每层的配置(系统、全局、本地)都会覆盖掉上一层次的配置,所以 .git/config
中的值会覆盖掉 /etc/gitconfig
中所对应的值。
1,设置你的名字和邮件地址
$ git config --global user.name "John Doe"
$ git config --global user.email johndoe@example.com
2,设置你的默认的编辑器
$ git config --global core.editor vim
3,设置Git 中的着色与字体属性
$ git config --global color.ui auto
color.branch 、color.diff 、color.interactive 、color.status