git-config
跳转到导航
跳转到搜索
用户的全局配置文件在 ~/.gitconfig ,项目的配置在 .git/config 。
使用 --global 参数修改用户配置文件 ~/.gitconfig ,否则修改的是局部于项目的。
要列出所有配置信息(不包括默认的),使用
git config --list
如在多个文件中配置了,配置项将列出多次。实际使用的是最后一次。
要查看某个选项的配置值,直接将选项名列在命令行上,如
git config user.name
用户
git config --global user.name "Your Name Comes Here"
git config --global user.email you@yourdomain.example.com
输出使用彩色
git config --global color.diff auto
git config --global color.status auto
git config --global color.branch auto
中文文件名
设置
git config --global core.quotepath false
即可正确显示中文等文件名
空白字符
git默认把行尾的空白当成错误。有时候并不希望如此(如Markdown)中。让git忽略此类情况
git config core.whitespace -blank-at-eol