zoukankan      html  css  js  c++  java
  • 在linux 下安装git

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

     

  • 相关阅读:
    Qt编写安防视频监控系统27-GPU显示
    Qt开源作品37-网络中转服务器
    【日拱一卒】链表——回文判断
    【日拱一卒】链表——判断链表是否有环
    【日拱一卒】链表——链表反转(递归解法)
    批处理文件bat设置环境变量path
    用来进行序列化和反序列化的工具类
    @JsonIgnoreProperties转换实体时忽略json中不存在的字段
    如何获取mac的ip地址
    objectMapper.convertValue
  • 原文地址:https://www.cnblogs.com/vania/p/7256205.html
Copyright © 2011-2022 走看看