源码安装git

系统: Centos

由于系统自带的yum源仓库的git版本较低,所以在官网下载源码进行编译安装

官网地址:https://git-scm.com/
源码下载地址:https://github.com/git/git

  1. 安装旧版本的git拉去git源码(如果是上传到服务器就不用了下载git了)

    [root@localhost ~]# yum -y install git
    
  2. 拉取git源码

    [root@localhost ~]# git clone https://github.com/git/git.git
    
  3. 安装可能需要的依赖

    [root@localhost ~]# yum -y install curl-devel expat-devel openssl-devel zlib-devel gcc-c++
    [root@localhost ~]# yum -y install perl-ExtUtils-MakeMaker automake autoconf libtool make
    
  4. 编译安装

    [root@localhost ~]# cd git/
    [root@localhost ~]# make configure
    [root@localhost git]# ./configure --prefix=/usr/local/git		# 安装在/usr/local目录下
    [root@localhost git]# make && make install
    
  5. 卸载旧的git并将新安装的git设置环境变量

    [root@localhost ~]# yum -y remove git
    [root@localhost ~]# echo 'export GIT_HOME=/usr/local/git' >> /etc/profile
    [root@localhost ~]# echo 'export PATH=$PATH:$GIT_HOME/bin' >> /etc/profile
    
  6. 加载配置文件,并查看git版本

    [root@localhost ~]# source /etc/profile
    [root@localhost ~]# git version
    
    git version 2.43.0
    

相关推荐

  1. 安装git

    2023-12-09 16:30:03       39 阅读
  2. 【大模型学习记录】db-gpt安装问题汇总

    2023-12-09 16:30:03       19 阅读
  3. LInux、编译安装

    2023-12-09 16:30:03       32 阅读

最近更新

  1. TCP协议是安全的吗?

    2023-12-09 16:30:03       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2023-12-09 16:30:03       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2023-12-09 16:30:03       18 阅读
  4. 通过文章id递归查询所有评论(xml)

    2023-12-09 16:30:03       20 阅读

热门阅读

  1. 查看域名A记录

    2023-12-09 16:30:03       28 阅读
  2. ogre3d 资料

    2023-12-09 16:30:03       38 阅读
  3. Flink 读写 HBase 总结

    2023-12-09 16:30:03       39 阅读
  4. Docker 常用命令

    2023-12-09 16:30:03       48 阅读
  5. 单元测试实战(一)Controller 的测试

    2023-12-09 16:30:03       41 阅读
  6. MySQL 配置和连接问题解决方案

    2023-12-09 16:30:03       40 阅读
  7. flink源码分析之功能组件(六)-心跳组件

    2023-12-09 16:30:03       42 阅读
  8. pgsql存储过程

    2023-12-09 16:30:03       33 阅读
  9. configure脚本的常用参数

    2023-12-09 16:30:03       40 阅读
  10. LambdaUpdateWrapper表达式新写法解释

    2023-12-09 16:30:03       35 阅读