mirror of
https://github.com/ZJDoc/GitGuide.git
synced 2026-07-29 15:20:25 +08:00
36 lines
650 B
Markdown
36 lines
650 B
Markdown
|
|
# 为每个项目单独设置用户名和邮箱
|
|
|
|
## 问题描述
|
|
|
|
提交`git`记录前需要先设置用户名和邮箱,最常用的方式就是全局设置
|
|
|
|
```
|
|
$ git config --global user.name xxx
|
|
$ git config --global user.email xxx
|
|
# 查看
|
|
$ git config -l
|
|
```
|
|
|
|
最近想要在服务器上进行版本管理,不方便全局设置,可以在项目路径下进行本地设置
|
|
|
|
## 方式一
|
|
|
|
进入项目路径,执行如下命令
|
|
|
|
```
|
|
$ git config --local user.name xxx
|
|
$ git config --local user.email xxx
|
|
# 查询
|
|
$ git config --local -l
|
|
```
|
|
|
|
## 方式二
|
|
|
|
直接在`.git/config`配置文件中设置
|
|
|
|
```
|
|
[user]
|
|
name = xxx
|
|
email = xxx
|
|
``` |