① 安装 Git

Linux 做为服务器端系统,Windows 作为客户端系统,分别安装 Git

服务器端:

#yum install -y git

安装完后,查看 Git 版本

[root@localhost ~]# git --version
git version 1.7.1

服务器端创建 git 用户,用来管理 Git 服务,并为 git 用户设置密码

[root@localhost home]# id git
id: git:无此用户
[root@localhost home]# useradd git
[root@localhost home]# passwd git

③ 服务器端创建 Git 仓库

设置 /home/data/git/gittest.git 为 Git 仓库

然后把 Git 仓库的 owner 修改为 git

[root@localhost home]# mkdir -p data/git/gittest.git
[root@localhost home]# git init --bare data/git/gittest.git
Initialized empty Git repository in /home/data/git/gittest.git/
[root@localhost home]# cd data/git/
[root@localhost git]# chown -R git:git gittest.git/

Gitlab是什么?

GitLab是一个利用 Ruby on Rails 开发的开源应用程序,实现一个自托管的Git项目仓库,可通过Web界面进行访问公开的或者私人项目。

它拥有与Github类似的功能,能够浏览源代码,管理缺陷和注释。可以管理团队对仓库的访问,它非常易于浏览提交过的版本并提供一个文件历史库。它还提供一个代码片段收集功能可以轻松实现代码复用,便于日后有需要的时候进行查找。

GitLab 5.0以前版本要求服务器端采用 Gitolite 搭建,5.0版本以后不再使用 Gitolite ,采用自己开发的 gitlab-shell 来实现。如果你觉得安装麻烦可以使用 GitLab Installers 一键安装程序。

Gitlab文档

gitlab英文官网:https://about.gitlab.com/

gitlab中文官网:https://www.gitlab.com.cn/

gitlab使用手册:https://docs.gitlab.com.cn/ce/README.html

Gitlab如何搭建?

1.安装gitlab所需要的依赖

sudo yum install curl policycoreutils openssh-server openssh-clients

发现出现错误:

根据提示可以选择按照以下进行依赖安装

sudo yum install curl policycoreutils openssh-server openssh-clients --skip-broken

 选择y

2.使sshd服务自动启动

sudo systemctl enable sshd

3.启动sshd服务

sudo systemctl start sshd

4.安装邮件服务器

sudo yum install postfix

5.使邮件服务器postfix自启动

sudo systemctl enable postfix

6. 启动邮件服务器postfix

sudo systemctl start postfix

7. 添加GitLab仓库,并安装到服务器上

curl -sS http://packages.gitlab.cc/install/gitlab-ce/script.rpm.sh | sudo bash

8.安装gitlab

sudo yum install gitlab-ce

安装完毕

如何启动GitLab?

1.启动,配置

sudo gitlab-ctl reconfigure

2.修改gitlab配置文件指定服务器ip和自定义端口

vi  /etc/gitlab/gitlab.rb

退出并保存
 
ps:注意这里设置的端口不能被占用,默认是8080端口,因为我这里8080已经使用,所以定义了其它端口,并在防火墙设置开放相对应得端口。
 

3.重置并启动GitLab

重新配置

gitlab-ctl reconfigure

重启

gitlab-ctl restart

访问gitlab:http://192.168.146.128:8888/

4. 处理502错误的方案

如果出现502的错误,那可能是端口的占用,导致启动不了应用。

Job for postfix.service failed because the control process exited with error code. See "systemctl status postfix.service" and "journalctl -xe" for details.

vim /etc/postfix/main.cf

inet_protocols = all
改成
inet_protocols = ipv4

 

在linux 下安装git的更多相关文章

  1. 环境部署(三):Linux下安装Git

    Git是一个开源的分布式版本控制系统,可以有效.高速的处理从很小到非常大的项目版本管理,是目前使用范围最广的版本管理工具. 这篇博客,介绍下Linux下安装Git的步骤,仅供参考,当然,还是yum安装 ...

  2. Linux下安装Git

    Ubuntu12.04中默认没有安装Git.需要自行安装. 1. 安装Git 1.1 Ubuntu12.04下 可以使用apt-get方式安装,也可以下载源代码安装[1],我们这里使用apt-git安 ...

  3. [v]Linux下安装Git

    Ubuntu12.04中默认没有安装Git.需要自行安装. 1. 安装Git 1.1 Ubuntu12.04下 可以使用apt-get方式安装,也可以下载源代码安装[1],我们这里使用apt-git安 ...

  4. 关于在linux下安装git,以及在idea上将项目部署到码云上

    GIT 基于对linux感兴趣,并且也考虑到以后从事开发后也会用到linux,着实在闲余之际学学linux.最近在用VM虚拟机环境下学做一个项目,在git上卡了一点时间,但同时也收获  了不少,下面写 ...

  5. Linux下安装git本地库与服务器端远程库

    1.    git是一个分布式版本管理系统,关于该工具的详细介绍,我认为廖雪峰老师介绍的非常全面:https://www.liaoxuefeng.com/wiki/896043488029600. 不 ...

  6. git常用命令和linux下安装git教程

    Debian/Ubuntu下使用apt-get安装git #安装libz-dev libssl-dev $ apt-get install libcurl4-gnutls-dev libexpat1- ...

  7. linux 下安装git的步骤方法

    ①.获取github最新的Git安装包下载链接,进入Linux服务器,执行下载,命令为: wget https://github.com/git/git/archive/v2.17.0.tar.gz  ...

  8. linux下安装Git并生成SSH key

    系统:contens7.4 1.下载源码解压 wget https://github.com/git/git/archive/v2.3.0.zip unzip v2.3.0.zip cd git-2. ...

  9. Linux下安装{Git}

    环境 { "操作系统":"CentOS 7.5 64位", "CPU":"1核", "内存":&qu ...

随机推荐

  1. centos7基础安装

    基础: hostname xxvim /etc/hostname systemctl stop firewalld systemctl disable firewalldsetenforce 0gre ...

  2. 2018.08.10【省赛&提高A组模拟】比赛总结

    题解 这次题目可真是太难了! 糟糕的运气使我AK的步伐寸步难行(士气严重下降). T1 这题还是比较水的(尽管我比赛时只拿了50分) 一些大佬们说:这题只是一道简单的暴力题,枚举l+二分r 就可以了. ...

  3. 检测Python程序本身是否已经在运行

    为runner.py实现一个函数,检测是否有其他的runner.py进程在正在执行? 除主要用到os模块,还用到了第三方模块psutil

  4. session的垃圾回收机制

    session.gc_maxlifetime session.gc_probability session.gc_divisor session.gc_divisor 与 session.gc_pro ...

  5. ArrayList扩容分析

    一段java代码 String e = "q3234v"; List<String> list = new ArrayList<String>(); for ...

  6. 命名空间System.IO

    基本介绍:System.IO 命名空间提供读写文件和数据流的类型.基本文件和目录支持的类型. 原文:http://blog.sina.com.cn/s/blog_48a45b950100erhz.ht ...

  7. java 问题汇总

    1.自动加载出错 require a bean of .... The injection point has the following annotations: - @org.springfram ...

  8. CentOS7部署HDP3.1.0.0

    Apache Ambari是一个基于Web的支持Apache Hadoop集群的供应.管理和监控的开源工具,Ambari已支持大多数Hadoop组件,包括HDFS.MapReduce.Hive.Pig ...

  9. 问题:tomcat启动后,可以访问主页面,但是无法访问dubbo-admin

    原因分析: 直接查看logs中的日志文件,发现一行 [Catalina-utility-1] org.apache.catalina.startup.HostConfig.undeploy Undep ...

  10. pl_sql例题

    0. 准备工作: set serveroutput on hellowrold 程序 begindbms_output.put_line('hello world');end;/ [语法格式]--de ...