git config專門用來配置或讀取相應的工做環境變量。而正是由這些環境變量,決定了 Git 在各個環節的具體工做方式和行爲。這些變量能夠存放在如下三個不一樣的地方:git
/etc/gitconfig
文件:系統中對全部用戶都廣泛適用的配置。若使用 git config
時用 --system
選項,讀寫的就是這個文件。~/.gitconfig
文件:用戶目錄下的配置文件只適用於該用戶。若使用 git config
時用 --global
選項,讀寫的就是這個文件。.git/config
文件):這裏的配置僅僅針對當前項目有效。每個級別的配置都會覆蓋上層的相同配置,因此 .git/config
裏的配置會覆蓋 /etc/gitconfig
中的同名變量。github
git config --global user.name "John Doe" git config --global user.email 123@123.com
去除 --global
即保存在當前項目的 .git/config
裏。若是你有github、碼雲項目能夠分別配置信息。vim
git config --global core.editor emacs
git config --global merge.tool vimdiff
git config --list