安装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