60 lines
864 B
Markdown
60 lines
864 B
Markdown
## git 多环境配置
|
||
|
||
|
||
|
||
### 多密钥配置
|
||
|
||
编辑 ~/.ssh/config 配置文件
|
||
|
||
```
|
||
# gitee
|
||
Host gitee.com
|
||
HostName gitee.com
|
||
Port 22
|
||
PreferredAuthentications publickey
|
||
IdentityFile ~/.ssh/id_rsa_gitee #平台私钥地址
|
||
|
||
# github
|
||
Host github.com
|
||
HostName github.com
|
||
Port 22
|
||
PreferredAuthentications publickey
|
||
IdentityFile ~/.ssh/id_rsa_github #平台私钥地址
|
||
|
||
|
||
|
||
#低版本 加密兼容
|
||
Host *
|
||
HostkeyAlgorithms +ssh-dss,ssh-rsa
|
||
PubkeyAcceptedKeyTypes +ssh-dss,ssh-rsa
|
||
|
||
```
|
||
|
||
|
||
|
||
|
||
|
||
### 提交用户配置
|
||
|
||
每个平台建立一个目录 该平台下的所有项目 放在该目录下
|
||
|
||
如:d:\work
|
||
|
||
在全局配置文件 `~/.gitconfig` 末尾追加配置
|
||
|
||
```
|
||
[includeIf "gitdir/i:d:/work/"]
|
||
path = ~/.gitconfig_work
|
||
```
|
||
|
||
在用户目录 `~` 新建 文件 `.gitconfig_work`
|
||
|
||
内容如下
|
||
|
||
```
|
||
[user]
|
||
email = xxxx@yilingairdata.com
|
||
name = xxxx
|
||
```
|
||
|