Git 构建分布式版本控制系统详解

该博客详细介绍了在Linux服务器上安装GitLab的步骤,包括安装依赖、配置邮件服务、关闭防火墙、设置SELinux、下载并安装GitLab软件包、初始化GitLab、生成SSH密钥以及进行初次Git操作。整个过程详尽且实用,适合需要搭建GitLab服务器的用户参考。
摘要由CSDN通过智能技术生成

安装git要4G以上内存

安装和配置必要的依赖关系
[root@localhost ~]# yum install curl policycoreutils openssh-server openssh-clients
安装邮件程序
[root@localhost ~]# yum install postfix
[root@localhost ~]# systemctl start postfix
[root@localhost ~]# systemctl enable postfix
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# setenforce 0
下载git包 本地有就直接上传 下载的特别慢
[root@localhost ~]# wget ftp://10.18.40.100/rpm-soft/gitlab-ce-9.1.0-ce.0.el7.x86_64.rpm
安装
[root@localhost ~]# yum -y install gitlab-ce-9.1.0-ce.0.el7.x86_64.rpm
自动配置文件权限,安装数据库….
安装时间会很长!!!

[root@localhost ~]# gitlab-ctl reconfigure
直接用ip访问就ok了
在这里插入图片描述在这里插入图片描述在这里插入图片描述在这里插入图片描述生成密钥
[root@localhost ~]# ssh-keygen
查看密钥
[root@localhost ~]# cat ~/.ssh/id_rsa.pub
在这里插入图片描述

把密钥复制粘贴到下面的图片上就ok了

在这里插入图片描述在这里插入图片描述在这里插入图片描述

命令行操作

[root@localhost ~]# git config --global user.name “git” #直接在虚拟机上使用
[root@localhost ~]# git config --global user.email “git@localhost” #@后面的是本机的主机名,也可以做域名解析
[root@localhost ~]# git clone git@gitlab.example.com:root/zhenjia.git #git clone 后面的是如下面图片上显示的你创建的机组的链接
在这里插入图片描述

完成上面的操作就好了,上面的操作是从gitlab下载到本地

下面的操作是从本地上传到gitlab

[root@localhost ~]# cd zhenjia.git #进入到工作目录,就是你从gitlab上下载到本地的那个目录
[root@localhost ~]# echo 12345678 > 2.sh #创建一个文件上传到gitlab上
[root@localhost ~]# git init #初始化
[root@localhost ~]# git add . #建立当前文件夹下所有的文件,为准备上传的文件
[root@localhost ~]# git commit -m ‘first commit’ # git commit 是提交上传的说明 后面的参数
[root@localhost ~]# git push -u origin master #上传命令
ok

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值