git config 命令

Git 基本操作Git 基本操作

git config 命令用于查看或者設(shè)置 git 倉(cāng)庫(kù)的配置信息。

 

1. git config 命令的語(yǔ)法

git config [<file-option>] [--type=<type>] [--show-origin] [-z|--null] name [value [value_regex]]

git config 命令的選項(xiàng)比較多,我們著重介紹常用的配置命令。

 

2. 查看 git 配置信息

1)查看 git 全部配置信息:

# 查看全部配置信息
git config --list --global

# 或者
git config -l --global

2)查看 git 某項(xiàng)的配置信息

# 查看 user.name 配置信息
git config --global user.name

# 查看 user.email 配置信息
git config --global user.email

參數(shù)說(shuō)明:

其中 --global 是作用域參數(shù)。還有 --local 和 --system。

--local 只對(duì)單個(gè)倉(cāng)庫(kù)有效。--system 對(duì)系統(tǒng)所有登錄用戶所有的倉(cāng)庫(kù)有效【很少用到】。--global 對(duì)當(dāng)前用戶所有的倉(cāng)庫(kù)有效【經(jīng)常用到】。

如果不加作用域參數(shù),默認(rèn)是 --local。

如果 global 和 local 都配置了,那么當(dāng)前倉(cāng)庫(kù)用的是 local 配置。

 

3. 初始化或者設(shè)置配置參數(shù)

設(shè)置配置項(xiàng)的語(yǔ)法格式:

    git config [--local|--global|--system] --unset section.key

范例:設(shè)置用戶名稱和用戶郵箱。

git config --global user.name 'your username'
git config --global user.email 'your email address'

 

4. 刪除配置項(xiàng)

刪除配置項(xiàng)的語(yǔ)法格式:

git config [--local|--global|--system] --unset section.key

范例:刪除用戶郵箱。

git config --global --unset user.email 'your email address'

Git 基本操作Git 基本操作

丰满人妻一级特黄a大片,午夜无码免费福利一级,欧美亚洲精品在线,国产婷婷成人久久Av免费高清