Git config 配置文件详解

一、配置文件级别

Git 使用简单的 .ini 文件作为配置文件,配置文件中记录了很多 Git 命令使用的各种选项和设置,Git 支持不同级别的配置文件,下面按照优先级从高到低的顺序对它们进行介绍:

.git/config           当前版本库特定的配置文件,可使用 --file选项修改,是Git的默认选项,此文件中的设置具有最高优先级。

~/.gitconfig         当前用户的配置文件,可使用 --global选项修改。

/etc/gitconfig      系统级别的配置文件,可使用 --system 选项修改,此文件中的设置优先级最低。

二、配置选项

git  config  --file  user.name  "sean"

git  config  --file  user.email  "sean@example.com"

git  config  --global  user.name  "sean"

git  config  --global  user.email  "sean@example.com"

git  config  --system  user.name  "sean"

git  config  --system  user.email  "sean@example.com"

三、移除配置

使用 git config -l 命令可列出在配置文件中配置的所有项。

git config --unset 可移除配置文件中的配置,使用方法如下:

       git  config  --unset  user.name

       git  config  --unset  --global  user.name

       git  config  --unset  --system  user.name

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值