捂脸斋

江山风月 🌘 本无常主 🌈 闲者便是主人 🍃🍃🍃

git 多账号配置

不同的公钥对应不同的网站

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# 使用 ssh-kengen 生成多个密钥,添加进gitee或者github。
# cd ~/.ssh
# touch config 文件,内容如下.
- gitee
Host gitee.com
Hostname gitee.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa_gitee

- github
Host github.com
Hostname github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa_github

设置user.nameuser.email

1
2
3
4
5
# 将gitee的仓库设置为public,clone代码。
# 进入代码目录。
git config user.name demo
git confgi user.email demo@foxmai.com
# 将gitee仓库设置为private。