本地局域网部署的gitlab使用教程

本地局域网部署的gitlab使用教程

很多企业(组织)会部署自己本地的gitlab进行代码管理,保证项目代码的安全性。只有数据在自己手里才是安全的。

本教程指导怎么在虚拟机中部署gitlab及进行局域网内的使用

基于docker部署gitlab

目前使用中文版本的gitlab,老版本的gitlab,新版本的限制了http访问,对很多设备,使用场景不够友好。并且这个老版本为中文版,方便国人使用。

配置docker-compose.yml内容如下:

shell 复制代码
version: '3.8'
services:
  gitlab:
    image: twang2218/gitlab-ce-zh:latest
    container_name: gitlab_cn
    restart: always
    hostname: 'gitlab'
    environment:
      TZ: "Asia/Shanghai"
      GITLAB_OMNIBUS_CONFIG: |
        external_url 'http://192.168.137.190:8090'
        gitlab_rails['gitlab_shell_ssh_port'] = 2222
        gitlab_rails['gitlab_shell_ssh_host'] = '192.168.137.190'
        gitlab_rails['gitlab_ssh_host'] = '192.168.137.190'
        nginx['listen_port'] = 80
        nginx['listen_https'] = false
        gitlab_rails['gitlab_default_theme'] = 2
        gitlab_rails['gitlab_default_projects_features_issues'] = true
        postgresql['shared_buffers'] = '256MB'
        unicorn['worker_processes'] = 2
        sidekiq['concurrency'] = 5
        prometheus['enable'] = false
        alertmanager['enable'] = false
    ports:
      - '8090:80'
      - '2222:22'
    volumes:
      - ./config:/etc/gitlab
      - ./data:/var/opt/gitlab
      - ./logs:/var/log/gitlab
    mem_limit: 4g
    mem_reservation: 2g
    cpu_shares: 512
    ulimits:
      nproc: 65535
      nofile:
        soft: 65535
        hard: 65535
    init: true

启动命令

shell 复制代码
# 启动
docker-compose up -d
# 检查运行效果,需要等待10分钟左右
docker ps

启动后效果如下:

登录浏览器检查效果如下:

局域网内使用该gitlab服务下

在局域网内使用该服务推荐使用http推送方式,注意不要直接使用网页提供的远程仓库地址,需要将该地址改为gitlab服务提供的主机地址才行,改为web网页对应的地址即可。

主要的事情说明:

  • 不要直接使用网页提供的远程仓库地址,需要将该地址改为gitlab服务提供的主机地址才行,改为web网页对应的地址即可。
  • 不要直接使用网页提供的远程仓库地址,需要将该地址改为gitlab服务提供的主机地址才行,改为web网页对应的地址即可。
  • 不要直接使用网页提供的远程仓库地址,需要将该地址改为gitlab服务提供的主机地址才行,改为web网页对应的地址即可。

教程如下:

新建项目

切换为http推送方式

idea中添加原创仓库地址

局域网内添加

填入用户名和密码

推送到远端

到web端检查推送效果

相关推荐
AlbertS10 小时前
记一次推送lfs失败不能迁移git仓库到新的gitlab的问题
git·ai·gitlab·lfs·rejected
日更嵌入式的打工仔11 小时前
Windows 下 GitLab 完整使用指南
windows·gitlab
会飞的大可11 小时前
Jenkins vs GitLab CI/CD:2026 企业级 CI/CD 工具深度选型评测
ci/cd·gitlab·jenkins
庭風1 天前
让 AI 从需求直接走到 MR:我开源了一个面向 GitLab 的工作流 MCP
gitlab
Sakuyu434682 天前
Git-GitLab-JenKins
git·gitlab·jenkins
Aaron_dw2 天前
基于 Jenkins + GitLab + 自动化测试的 CI/CD 自动化系统方案(IaC + 弹性构建节点)
ci/cd·gitlab·jenkins
虎头金猫2 天前
自建 GitLab 没公网?用内网穿透技术,远程开发协作超丝滑
运维·服务器·网络·开源·gitlab·开源软件·开源协议
MinterFusion3 天前
如何在openKylin下安装并配置GitLab(v0.1.1)
gitlab·系统维护·devops工具·麒麟操作系统·明德融创·openkylin
我就是你毛毛哥4 天前
Docker 安装 GitLab
docker·容器·gitlab
雨声不在6 天前
gitlab中的repo删除特定commit
gitlab