- 设置用户信息
$ git config --global user.name "John Doe"
$ git config --global user.email johndoe@example.com
如果使用了 –global 选项,那么该命令只需要运行一次,因为之后无论你在该系统上做任何事情, Git 都会使用那些信息。 当你想针对特定项目使用不同的用户名称与邮件地址时,可以在那个项目目录下运行没有 –global 选项的命令来配置。
配置默认文本编辑器
Git 会使用操作系统默认的文本编辑器,通常是 Vim。 如果你想使用不同的文本编辑器
$ git config --global core.editor emacs
检查配置信息
$ git config --list
user.name=John Doe
user.email=johndoe@example.com
color.status=auto
color.branch=auto
color.interactive=auto
color.diff=auto
...
- 检查git的某一项配置
$ git config user.name
John Doe