gitlab安装和使用

gitlab安装和使用

1.下载必要的依赖

bash 复制代码
    sudo yum install curl openssh-server openssh-clients postfix cronie  #需要执行
    sudo service postfix start #配置邮箱的
    sudo chkconfig postfix on #配置邮箱的
    #这句是用来做防火墙的,避免用户通过ssh方式和http来访问。
    sudo lokkit -s http -s ssh

2.下载gitlab安装包

清华大学镜像源:https://mirror.tuna.tsinghua.edu.cn/help/gitlab-ce

下载完放到指定位置

进入目录安装命令

bash 复制代码
rpm -ivh ./gitlab-ce-14.10.5-ce.0.el7.x86_64.rpm

3.修改必要的配置文件

bash 复制代码
vim /etc/gitlab/gitlab.rb 
bash 复制代码
    #外部访问url(经过编译后,自动将这个配置编译到nginx配置,nginx就无需配置了)
    external_url 'http://192.168.0.1:8888'
    #默认值就是8080。如果端口被占用,可将8080修改为其它(例如:9090)
    unicorn['port'] = 8080  #gitlab版本不同,这个配置项可能不存在

4.是配置文件生效

bash 复制代码
    #使配置生效
    gitlab-ctl reconfigure
    #重新启动GitLab 
    gitlab-ctl restart

5.登录网页-默认密码

密码放在了一个临时文件中

密码位置:/etc/gitlab/initial_root_password

密码需要及时修改,24小时会自动删除

6.修改密码

http://110.42.188.114:8888/users/sign_in

root !QAZ2wsx

7.增加用户

8.测试分享代码

9.上传clone创建分支,提交代码

  • gitlab-ce-14初装以后,把密码放在了一个临时文件中了

常用的gitlab命令

bash 复制代码
    gitlab-ctl start    # 启动所有 gitlab 组件;
    gitlab-ctl stop        # 停止所有 gitlab 组件;
    gitlab-ctl restart        # 重启所有 gitlab 组件;
    gitlab-ctl status        # 查看服务状态;
    vim /etc/gitlab/gitlab.rb        # 修改gitlab配置文件;
    gitlab-ctl reconfigure        # 重新编译gitlab的配置;
    gitlab-rake gitlab:check SANITIZE=true --trace    # 检查gitlab;
    gitlab-ctl tail        # 查看日志;
    gitlab-ctl tail nginx/gitlab_access.log

git的使用

  1. 安装git yum install git

  2. 查看git 版本 git --version

  3. 配置git

    git config --global user.email "you@example.com" git config --global user.name "Your Name"

参考资料:CentOs7 安装Gitlab

相关推荐
Patrick_Wilson16 小时前
为什么gitlab的MR会默认有一个merge commit
前端·git·gitlab
极小狐21 小时前
极狐GitLab Duo 功能更新:扩展 MCP 工具集、支持 MR 事件触发
运维·gitlab·agent·mr·极狐gitlab·mcp·极狐gitlab duo
2501_928996221 天前
GitLab CVE-2026-19478漏洞解析:Gitaly ref攻击绕过审计与中科热备下的代码资产保护重构
重构·gitlab
秦渝兴2 天前
GitLab CI/CD 流水线实战
ci/cd·gitlab
Ningcode_cloud3 天前
什么是CICD? GitLab + Jenkins 持续集成实战部署手册
运维·ci/cd·云原生·容器·gitlab·jenkins
姚永强3 天前
gitlab安装
运维·gitlab
力江4 天前
GitLab 私有化部署实战 —— 从 Omnibus 到 Docker 的踩坑之旅
docker·容器·gitlab
极小狐8 天前
从 GitLab Flow 到 Pipeline:分支策略 + CI/CD + 运维一文打通
ci/cd·gitlab·devops·极狐gitlab
猫头虎9 天前
GitHub 入门教程:如何加入并为开源项目贡献代码
gitee·开源·gitlab·github·开放原子·开源协议·gitcode