- 系統:讀
/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 [email protected]
2,設置你的默認的編輯器
$ git config --global core.editor vim
3,設置Git 中的着色與字體屬性
$ git config --global color.ui auto
color.branch 、color.diff 、color.interactive 、color.status 定製着色爲 normal
、black
、red
、green
、yellow
、blue
、magenta
、cyan
或 white
。字體屬性的話,可以選擇包括:bold
、dim
、ul
(下劃線)、blink
、reverse
(交換前景色和背景色)。
$ git config --global color.diff.meta "blue black bold"