一,安装
1、docker 安装
前提是上节已经装好docker-compose
换成自己的ip
[root@node2 ~] mkdir gitlab
[root@node2 gitlab] cd gitlab
[root@node2 gitlab] vim docker-compose.yml
version: '3.1'
services:
gitlab:
image: 'gitlab/gitlab-ce:latest'
container_name: gitlab
restart: always
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url 'http://192.168.11.11:8929'
gitlab_rails['gitlab_shell_ssh_port'] = 2224
ports:
- '8929:8929'
- '2224:2224'
volumes:
- './config:/etc/gitlab'
- './logs:/var/log/gitlab'
- './data:/var/opt/gitlab'
2.安装
[root@node2 gitlab] docker-compose up -d
3.查看密码:
[root@node2 gitlab] docker exec -it gitlab cat /etc/gitlab/initial_root_password
[root@node2 gitlab]# docker exec -it gitlab cat /etc/gitlab/initial_root_password
# WARNING: This value is valid only in the following conditions
# 1. If provided manually (either via `GITLAB_ROOT_PASSWORD` environment variable or via `gitlab_rails['initial_root_password']` setting in `gitlab.rb`, it was provided before database was seeded for the first time (usually, the first reconfigure run).
# 2. Password hasn't been changed manually, either via UI or via command line.
#
# If the password shown here doesn't work, you must reset the admin password following https://docs.gitlab.com/ee/security/reset_user_password.html#reset-your-root-password.
Password: Lwj/TwtfIVAt9qzDrr8TEdp8e0ch5TFLxUPDqw4IXIE=
# NOTE: This file will be automatically deleted in the first reconfigure run after 24 hours.
4.登录:
地址:http://192.168.11.11:8929
用户为:root
密码:Lwj/TwtfIVAt9qzDrr8TEdp8e0ch5TFLxUPDqw4IXIE=
二、使用
1.从gitlab拉代码到本地(http模式)
1.1、创建个人令牌,记得保存,如生成我自己的:d_xAdf7KusJGDn43HHcQ,过程如下
1.2 拉取代码
1.2.1 获取clone链接(http模式,不是ssh模式)
1.2.2 拉取代码链接格式为:
-
说明:只是复制以上的地址链接是拉取不到代码的,毕竟是私人仓库还要认证,所以要对以上的地址改装为已经认证的地址,让它在任何的idea上都可以拉取代码
-
格式:http://用户名:token@+http地址
-
综上就获得我们的拉取代码实际的链接:
http://guyusi:d_xAdf7KusJGDn43HhcQ@47.112.155.60:8929/root/devops.git
1.2.3 在idea中获取代码:
以上就可以拉去代码了