git程序包含客户端和服务端两个程序,作为开发者基本不用接触服务端配置,所以这里只介绍客户端配置。
配置文件:
-
/etc/gitconfig
全局配置 -
~/.gitconfig
或~/.config/git/config
用户配置 -
/path/to/project/.git/config
项目配置
与npm配置命令相似,git也有配置命令
git config
,推荐使用git config -e
命令编辑配置文件:
-
git config -e --system
编辑全局配置文件 -
git config -e --global
编辑用户配置文件 -
git config -e
编辑当前项目配置文件
我的配置
;;;;
; 全局配置
;;;;
[core]
editor=vim
;;;;
; 用户配置
;;;;
[user]
name = 张家泳
email = daifee@daifee.com
;;;;
; 项目配置
;;;;
[core]
autocrlf=true
网友评论