mirror of
https://github.com/ZJDoc/GitGuide.git
synced 2026-07-29 15:20:25 +08:00
docs(git): add advanced and error
This commit is contained in:
36
docs/git/advanced/为每个项目单独设置用户名和邮箱.md
Normal file
36
docs/git/advanced/为每个项目单独设置用户名和邮箱.md
Normal file
@@ -0,0 +1,36 @@
|
||||
|
||||
# 为每个项目单独设置用户名和邮箱
|
||||
|
||||
## 问题描述
|
||||
|
||||
提交`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
|
||||
```
|
||||
Reference in New Issue
Block a user