GitLab

GitLab 是一个用于仓库管理系统的开源项目,使用Git作为代码管理工具,并在此基础上搭建起来的web服务。
GitLab是由GitLabInc.开发,使用MIT许可证的基于网络Git仓库管理工具,且具有wiki和issue跟踪功能。使用Git作为代码管理工具,并在此基础上搭建起来的web服务。

1.配置yum源

[[email protected] ~]# vim /etc/yum.repos.d/yum.repo
[gitlab-ce]
name=gitlab-ce
baseurl=http://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7
Repo_gpgcheck=0
Enabled=1
gpgcheck=0

2.更新本地yum缓存 

[[email protected] ~]# yum makecache   #更新本地yum缓存

3. 安装GitLab社区版

[[email protected] ~]# yum  install gitlab-ce.x86_64 -y  #安装GitLab社区版  

4.设置GitLab访问IP

[[email protected] ~]# vim  /etc/gitlab/gitlab.rb
external_url 'http://192.168.74.12'                #访问gitlab的地址         可以是内网IP也可以是公网ECS服务器的公网IP
[[email protected] ~]#  gitlab-ctl reconfigure      #重载服务
# 过程较长耐心等待 

 GitLab常用命令

gitlab-ctl start               # 启动所有 gitlab 组件;
gitlab-ctl stop               # 停止所有 gitlab 组件;
gitlab-ctl restart           # 重启所有 gitlab 组件;
gitlab-ctl status           # 查看服务状态;
gitlab-ctl reconfigure        # 启动服务;
vim /etc/gitlab/gitlab.rb    # 修改默认的配置文件;
gitlab-rake gitlab:check SANITIZE=true --trace    # 检查gitlab;
gitlab-ctl tail        # 查看日志;

登录GitLab

第一次登录使用的用户名和密码为 root 和 5iveL!fe。

GitLab安装与使用

首次登录会强制用户修改密码。密码修改成功后,输入新密码进行登录。

 

创建Project

1. 安装Git

[[email protected] ~]# yum install -y git

2. 生成**文件

[[email protected] ~]# ssh-******         #一路回车

GitLab安装与使用

GitLab安装与使用

3.在GitLab的主页中新建一个Project

GitLab安装与使用

GitLab安装与使用

4.添加ssh key导入步骤2中生成的**文件内容:

GitLab安装与使用

ssh key添加完成:

GitLab安装与使用

配置用户信息

# 配置使用Git仓库的人员姓名
[[email protected] ~]# git config --global user.name "燕子李三"
# 配置使用Git仓库的人员email,填写自己的公司邮箱创建需要上传到GitLab中的目标文件
[[email protected] ~]# git config --global user.email "[email protected]"

查看列表 

[[email protected] ~]# git config --global --list
user.name=燕子李三
[email protected]

克隆项目,在本地生成同名目录,并且目录中会有所有的项目文件

[[email protected] ~]# git clone [email protected]:root/test.git
正克隆到 'test'...

创建需要上传到GitLab中的目标文件

1、进入到项目目录
[[email protected] ~]# cd test/ 
2、创建需要上传到GitLab中的目标文件
[[email protected] test]# cp /root/test.sh ./
3、 将目标文件或者目录拷贝到项目目录下
[[email protected] test]# cp /root/test.sh ./

GitLab安装与使用

4、将test.sh文件加入到索引中
[[email protected] test]# git commit -m test.sh
5、将test.sh提交到本地仓库
[[email protected] test]# git push -u origin master
6、将文件同步到GitLab服务器上
[[email protected] test]# git push -u origin master  

GitLab安装与使用

在网页中查看上传的test.sh文件已经同步到GitLab中

GitLab安装与使用

 

相关文章:

  • 2022-12-23
  • 2021-10-01
  • 2021-08-24
  • 2021-06-22
  • 2021-05-13
  • 2021-10-21
  • 2021-09-30
猜你喜欢
  • 2022-02-07
  • 2021-07-29
  • 2021-12-27
  • 2022-12-23
  • 2022-12-23
  • 2021-05-04
  • 2021-09-17
相关资源
相似解决方案