CentOS 7.4 系统安装 git

 

 Body

CentOS 7.4 系统安装 git

CentOS下面安装git的命令

一、使用yum安装

1、查看系统是否已经安装git

[root@localhost ~]# git –version

2、CentOS6.5 yum 安装git

[root@localhost ~]# yum install git

 

3、安装成功

[root@localhost ~]# git version

git version 1.7.1

[root@localhost ~]# git –version

git version 1.7.1

 

4、卸载git

[root@localhost ~]# yum remove git

二、源代码安装

 

在Linux下安装Git

  Git是一个开源的分布式版本控制系统,可以有效、高速的处理从很小到非常大的项目版本管理。而国外的GitHub和国内的Coding都是项目的托管平台。但是在使用Git工具的时候,第一步要学会如何安装git,本教程就手把手教大家如何手动编译安装git。

1、介绍

  使用Coding管理项目,上面要求使用的git版本为1.8.0以上,而很多yum源上自动安装的git版本为1.7,所以需要掌握手动编译安装git方法。

2、安装git依赖包

  yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker

3、删除已有的git

  yum remove git

4、下载git源码

  4.1、切换到你的包文件存放目录下

    cd /usr/src

  4.2、下载git安装包

    wget https://www.kernel.org/pub/software/scm/git/git-2.8.3.tar.gz –no-check-certificate

  4.3、解压git安装包

    tar -zxvf git-2.8.3.tar.gz

    cd git-2.8.3

  4.4、配置git安装路径

    ./configure prefix=/usr/local/git/

  4.5、编译并且安装

    make && make install

5、将git指令添加到bash

  vi /etc/profile

  在最后一行加入

  export PATH=$PATH:/usr/local/git/bin

    

  让该配置文件立即生效

  source /etc/profile

6、查看git版本号

  git –version

  [root@localhost ~]# git version

  git version 2.8.3

  git已经安装完毕

参考:https://www.cnblogs.com/lhbryant/p/6928894.html

发表回复

关闭菜单