生成公钥
以gitlab为示例
ssh-keygen -t rsa -C 'xxx@outlook.com' -f ~/.ssh/gitlab-rsa
创建配置文件
vi ~/.ssh/config
针对每个域名做配置
# gitosis
Host 120.xx.xx.xx
User git
Port 22
StrictHostKeyChecking no
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa
# gitlab
Host gitlab.com
Hostname gitlab.com
IdentityFile ~/.ssh/gitlab-rsa
# gitee
Host gitee.com
Hostname gitee.com
IdentityFile ~/.ssh/gitee-rsa
提交信息
配置每个项目的单独提交信息
需要到项目根目录执行,不做全局配置
git config user.name "xxxxxx"
git config user.email "xxxxxx@outlook.com"
网友评论