1.用戶名和郵箱地址的作用
用戶名和郵箱地址是本地git客戶端的一個變量
每次commit都會用用戶名和郵箱紀錄。
github的contributions統計就是按郵箱來統計的。
2.查看用戶名和郵箱地址
$ git config user.name $ git config user.email
3.修改用戶名和郵箱地址
$ git config --global user.name "username" $ git config --global user.email "email"
4.查看配置文件的位置
位置1:/etc/gitconfig
系統級別的配置,適用於所有的用戶和所有的庫,可以使用 $git config --system 來指定和修改,存儲在Git安裝目錄下
位置2:~/.gitconfig
用戶級別的配置,適用於當前登錄的用戶,可以使用$git config --gloabal來指定和修改,存儲在C:\Documents and Settings\$USER下
位置3:.git/config
庫級別的配置,適用於某個具體的庫,可以使用$git config來指定和修改,存儲在具體的庫隱藏的.git文件夾下
說明:Git會優先使用庫級別的配置,再然后是global級別的配置,最后是system級別的配置.
參考文檔
http://blog.csdn.net/autoliuweijie/article/details/52230165
http://www.cnblogs.com/wanqieddy/archive/2012/08/03/2621027.html