git 设置用户名邮箱
用下面的语句可以在git中设置你的github账户和邮箱,
git config --global user.name "your username"
git config --global user.email "your email"
--global
含义
- 意为全局,加了这个选项 意味着你配置的是全局的用户,在任何一个文件夹都将使用这个配置
- 存放的位置
C:\Users\49579\.gitconfig
注:其中的"49579"是我个人电脑的用户名,每个人的不尽相同.
git config --local user.name "your username"
git config --local user.email "your email"
--local
含义
- 意为当地,即你当前打开git bash的文件夹目录
- 存放的位置 为当前目录下的
.git\config
注意: 笔者曾在试验过程中,尝试用这种方法重复设置用户 邮箱,发现这样设置可能会不成功,甚至在使用git config --list
查看时会有两个user.name 所以尽量使用配置文件配置吧.
config常用代码概览
添加
$ git config --global user.name "yourName"
$ git config --global user.email "your@email.com"
修改
覆盖形式
$ git config --global user.name "yourName"
$ git config --global user.email "your@email.com"
替换形式
$ git config --global --replace-all user.name "yourName"
$ git config --global --replace-all user.email "your@email.com"
删除形式
$ git config --global --unset user.name "yourName"
$ git config --global --unset user.email "your@email.com"
查看形式
(1)查看所有
$ git config --list
(2)查看指定信息
$ git config user.name
$ git config user.email
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。