日期 版本 作者 说明
2020-07-29 V-1.0 孔留锋 配置。

概要

简介

​ 同时配置GitLab、GitHub、Gitee,前提需要安装Git。

前提

1
2
3
4
5
6
# 查看全局的user.name 和 user.email
git config --global --list
# 清除全局配置

git config --global --unset user.name "kongliufeng"
git config --global --unset user.email "814345920@qq.com"

Gitee安装

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#1.生成Gitee密钥
ssh-keygen -t rsa -f ~/.ssh/id_rsa_gitee -C "814345920@qq.com"

#完成后会在~/.ssh / 目录下生成以下文件
id_rsa.id_rsa_gitee
id_rsa.id_rsa_gitee.pub

#2.添加规制
ssh-agent bash
ssh-add ~/.ssh/id_rsa_gitee

ssh -T git@gitee.com

# 3.修改config
#编辑文件 ~/.ssh/config
#添加如下
#gitee
Host gitee
Port 22
HostName gitee.com
User git
IdentityFile ~/.ssh/id_rsa_gitee

#4.登录gitee ,配置ssh密钥 id_rsa_gitee.pub 密钥。

#5.测试链接
ssh -T git@gitee.com
Hi K_GeDream! You've successfully authenticated, but GITEE.COM does not provide shell access.

登录gitlab账号,配置ssh密钥 id_rsa_klb.pub 密钥。

GitHub安装

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#1.生成Gitee密钥
ssh-keygen -t rsa -f ~/.ssh/id_rsa_github -C "814345920@qq.com"

#完成后会在~/.ssh / 目录下生成以下文件
id_rsa.id_rsa_github
id_rsa.id_rsa_github.pub

#2.添加规制
ssh-agent bash
ssh-add ~/.ssh/id_rsa_github

# 3.修改config
#编辑文件 ~/.ssh/config
#添加如下
#gitHub
Host github
Port 22
HostName github.com
User 814345920@qq.com
IdentityFile ~/.ssh/id_rsa_github

#4.登录gitee ,配置ssh密钥 id_rsa_gitee.pub 密钥。

#5.测试链接
ssh -T git@github.com
Hi kongliufeng! You've successfully authenticated, but GitHub does not provide shell access.

登录gitlab账号,配置ssh密钥 id_rsa_klb.pub 密钥。

GitLab安装

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#1.生成GitLab密钥
ssh-keygen -t rsa -f ~/.ssh/id_rsa_klb -C "kongliufeng@qq.com"

#完成后会在~/.ssh / 目录下生成以下文件
id_rsa.id_rsa_klb
id_rsa.id_rsa_klb.pub

#2.添加规制
ssh-agent bash
ssh-add ~/.ssh/id_rsa_klb

# 3.修改config
#编辑文件 ~/.ssh/config
#添加如下
#Default gitlab user Self
Host gitlab
Port 8090
HostName 114.115.XX.XX
User kongliufeng@qq.com
IdentityFile ~/.ssh/id_rsa_klb

#4.登录gitlab ,配置ssh密钥 id_rsa_klb.pub 密钥。

#5.测试项目下载
git clone http://114.115.XX.XX:8090/future/XX.git

登录gitlab账号,配置ssh密钥 id_rsa_klb.pub 密钥。

image-2020072903142737850