git02 - git config 配置记录
This commit is contained in:
parent
a54f0c74b9
commit
71177e1817
69
git02.md
Normal file
69
git02.md
Normal file
@ -0,0 +1,69 @@
|
||||
## git config 配置
|
||||
|
||||
- 安全和隐私
|
||||
- 设置指令别名,提高工作效率
|
||||
- 设置默认选项
|
||||
|
||||
### 1. 查看当前 `config` 配置
|
||||
```
|
||||
git config --list
|
||||
```
|
||||

|
||||
|
||||
|
||||
### 2. 用户名 & 邮箱配置
|
||||
#### 2.1 为什么要单独配置?
|
||||
<font size="2">  
|
||||
为了防止工作用户&邮箱和个人用户&邮箱混淆,防止信息泄露。
|
||||
</font>
|
||||
|
||||
#### 2.2 三种级别说明
|
||||
- system 级别
|
||||
- global 级别
|
||||
- local 级别
|
||||
|
||||
<font size="2">  
|
||||
git 读取时:优先从 local > global > system 级别
|
||||
</font>
|
||||
|
||||
#### 2.3 全局 & 局部配置
|
||||
> 系统级配置 `--system`
|
||||
|
||||
<font size="2">  
|
||||
系统用户级的配置,一般不用。
|
||||
</font>
|
||||
|
||||
> 全局设置 `--global`
|
||||
```
|
||||
git config --global user.name '***'
|
||||
git config --global user.email '***@**.com'
|
||||
```
|
||||
|
||||
> 局部设置 `--local`
|
||||
|
||||
<font size="2">  
|
||||
不写默认是局部
|
||||
</font>
|
||||
```
|
||||
git config user.name '***'
|
||||
git config user.email '***@**.com'
|
||||
```
|
||||

|
||||
|
||||
|
||||
### 3. `alias` 别名全局配置
|
||||
#### 3.1 常用指令别名配置
|
||||
```
|
||||
git config --global alias.st status
|
||||
git config --global alias.pl pull
|
||||
git config --global alias.ps push
|
||||
```
|
||||
|
||||
#### 3.2 操作截图
|
||||

|
||||
|
||||
|
||||
### 4. 默认选项配置
|
||||
```
|
||||
git config --global pull.rebase true
|
||||
```
|
BIN
git02_files/1.jpg
Normal file
BIN
git02_files/1.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 124 KiB |
BIN
git02_files/2.jpg
Normal file
BIN
git02_files/2.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 155 KiB |
BIN
git02_files/3.jpg
Normal file
BIN
git02_files/3.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 168 KiB |
Loading…
x
Reference in New Issue
Block a user