环境
- 系统:window 10 x64
- git版本:Git for windows 2.8.1
配置文件优先级
- 仓库(.git/config) > 用户(-global) > 系统(-system)
配置的方式
直接修改文件
- 不同的级别不同位置
- 仓库级:仓库下的config .git/config
- 用户级:
- 系统级:
使用命令行
- windows:
- cmd
- Git Bash :鼠标右键 git bash here 或应用中
配置命令格式
配置的方式
- git配置的命令为 git config;
- 查看config文档: git config –help
查看已配置内容:
* 单项:git config 属性
* 如查看已配置的用户名:git config user.name
* 查看所有已配置属性:
* git config --list
配置
- 配置基本格式
- git config 位置 属性 属性内容
- 如配置用户级的git用户名:
git config –global user.name “John Doe” - 位置:
- 仓库级:在仓库目录下使用不带位置的config
- 用户级: 位置中使用 –global
- 系统级: –system
- 如配置用户级的git用户名:
- git config 位置 属性 属性内容
- 基本配置:用户名和邮箱,在每次提交时都要用到。
- git config –global user.name “你的用户名”
- git config –global user.email 你的邮箱地址
常用配置
- 用户名:
git config –global user.name “” - 邮箱:
git config –global user.email your - 默认编辑器:
git config –global core.editor