基于docker的GitLab(github 私服)
blog 2019-10-17
gitlab
GitLab 自搭建仓库
1.在docker compose 容器下 搭建 Gitlab
cd /usr/local/docker/gitlab
2.创建 docker-compose.yml
version: '3'
services:
web:
image: 'twang2218/gitlab-ce-zh:10.5'
restart: always
hostname: '192.168.123.3'
environment:
TZ: 'Asia/Shanghai'
GITLAB_OMNIBUS_CONFIG: |
external_url 'http://192.168.123.3:8080'
gitlab_rails['gitlab_shell_ssh_port'] = 2222
unicorn['port'] = 8888
nginx['listen_port'] = 8080
ports:
- '8080:8080'
- '8443:443'
- '2222:22'
volumes:
- /usr/local/docker/gitlab/config:/etc/gitlab
- /usr/local/docker/gitlab/data:/var/opt/gitlab
- /usr/local/docker/gitlab/logs:/var/log/gitlab
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# 使用 SSH 的方式拉取和推送项目
# #生成 SSH KEY
使用 ssh-keygen 工具生成,位置在 Git 安装目录下,我的是 C:\Program Files\Git\usr\bin
输入命令:
ssh-keygen -t rsa -C "your_email@example.com"
1
执行成功后的效果:
Microsoft Windows [版本 10.0.14393]
(c) 2016 Microsoft Corporation。保留所有权利。
C:\Program Files\Git\usr\bin>ssh-keygen -t rsa -C "topsale@vip.qq.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/Lusifer/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/Lusifer/.ssh/id_rsa.
Your public key has been saved in /c/Users/Lusifer/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:cVesJKa5VnQNihQOTotXUAIyphsqjb7Z9lqOji2704E topsale@vip.qq.com
The key's randomart image is:
+---[RSA 2048]----+
| + ..=o=. .+. |
| o o + B .+.o.o |
|o . + +=o+.. |
|.= . oo... |
|= o So |
|oE . o |
| .. .. . |
| o*o+ |
| *B*oo |
+----[SHA256]-----+
C:\Program Files\Git\usr\bin>
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
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
# #复制 SSH-KEY 信息到 GitLab
秘钥位置在:C:\Users\你的用户名\.ssh 目录下,找到 id_rsa.pub 并使用编辑器打开
登录 GitLab,点击“用户头像”-->“设置”-->“SSH 密钥”