centos 安装git

1、安装依赖库:yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel

                           yum install gcc-c++ perl-ExtUtils-MakeMaker

2、下载

      1.1、进入到要下载的目录:cd /usr/local

      1.2、用wegt命令进行下载:wget https://www.kernel.org/pub/software/scm/git/git-2.19.2.tar.gz

3、解压:此处解压到/usr/local目录下

     tar -xzvf soft git-2.19.2.tar.gz 

4、安装

     4.1、进入解压后的git目录:cd /usr/local/git-2.19.2

     4.2、执行make configure

              注意:执行此命令时,开始出错,错误如下:

              configure: Setting lib to 'lib' (the default)

              configure: Will try -pthread then -lpthread to enable POSIX Threads.

              configure: CHECKS for site configuration

              checking for gcc... no

              checking for cc... no

              checking for cl.exe... no

              configure: error: in `/opt/git-2.19.0':

              configure: error: no acceptable C compiler found in $PATH

              See `config.log' for more details  

              解决办法:通过yum providers gcc 和 yum providers cc 查询到c编译器没有安装,可通过执行yum -y install gcc安装gcc包及对应的依赖。

              再次执行make configure,再次出现错误,错误如下:

              GIT_VERSION = 2.19.2

              GEN configure

              bin/sh:autoconf:未找到命令

              make:***[configure]错误127

              解决办法:通过yum providers autoconf 查询到没有安装autoconf,可通过执行yum -y install autoconf安装包及对应的依赖。 

     4.3、配置目录:./configure --prefix=/usr/local/git

     4.4、执行 make profix=/usr/local/git

     4.5、进行安装,执行 make install

5、配置Git环境变量

     vi /etc/profile

     在文件尾添加
     export GIT_HOME=/usr/local/git
     export PATH=$PATH:$GIT_HOME/bin

6、检查版本:git --version

      如果显示:git version 2.19.2 则证明安装成功!
 

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值