更新 git 多环境配置
This commit is contained in:
parent
b618ef187d
commit
074b2d3453
59
git/git多环境配置.md
Normal file
59
git/git多环境配置.md
Normal file
@ -0,0 +1,59 @@
|
||||
## 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
|
||||
```
|
||||
|
Loading…
x
Reference in New Issue
Block a user