[TOC] 查看所有的配置信息 (其中 --list 可简写为 -l) ```bash git config --list ``` #### 1. 查看或配置用户名、邮箱 --- **查看或配置用户名、邮箱** 温馨提示: 这里的用户名和邮箱只是用在提交记录中的显示,和是否有权限提交代码无关,这是很多人的误区 ``` git config [--global] user.name [用户名] git config [--global] user.emial [邮箱] ``` **查看配置的用户名、邮箱** ``` // 查看全局配置 cat ~/.gitconfig // 查看当前仓库配置 cat .git/config // 查看git配置信息 (--list 可以简写为 -l) git config --list ``` **** #### 2. git 全局配置信息在 `当前用户根目录下的.gitconfig` 文件中 --- ``` C:\Users\Dell\.git\config ``` ```php git config --global user.name liang ``` ```php git config --global user.email 23426945@qq.com ``` ![](https://img.itqaq.com/art/content/b33e2247b5c837fea2ba76fef86ba3dc.png) #### 3. 设置单个库的作者信息,单个库的配置存在 `.git/config` 文件中 --- ``` git init git config user.name zhangsan cat .git/config ``` ![](https://img.itqaq.com/art/content/8a64686452cb51a4f5dbeeb7e1d3c71c.png)