Git CMD - config: Get and set repository or global options

 

命令参数

--get

获取指定的配置项。

--global

对于写选项:全局配置,将参数配置于 ~/.gitconfig 而不是仓库目录下的 .git/config。对于读选项:只从 ~/.gitconfig 文件中读取配置。

--local

  对于写选项:将参数配置于 仓库目录下的 .git/config,这是默认的设置。

-l, --list

  列出配置文件中的所有配置项。

 

配置文件

如果没有显示地指定 --file 选项,则有 4 个文件供 git 配置查询配置项。

$(prefix)/etc/gitconfig

全系统的配置文件

~/.gitconfig

用户特定的配置文件,也称为全局配置文件。

$XDG_CONFIG_HOME/git/config

用户特定的次要的配置文件。如果 $XDG_CONFIG_HOME 没有设置或者为空,$HOME/.config/git/config 会被替代。

$GIT_DIR/config

仓库特定的配置文件。

实例

a) 设置用户名与用户邮件 ID

$ git config --global user.name "huey"
$ git config --global user.email "huey@example.com"

b) 设置颜色高亮

$ git config --global color.ui true

c) 列出当前的配置选项

$ git config --list

 

更多

http://git-scm.com/docs/git-config

posted on 2015-12-30 10:51  huey2672  阅读(620)  评论(0编辑  收藏  举报