当前位置: 首页 > news >正文

【个人记录】CentOS7 编译安装最新版本Git

说明

使用yum install git安装的git版本是1.8,并不是最新版本,使用gitlab-runner托管时候会拉项目失败,这里使用编译源码方式安装最新版本的git。

基础环境安装

echo "nameserver 8.8.8.8" >> /etc/resolv.conf
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum install git curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker -y

注意这里安装的git是旧版本的,为了拉取git源码使用,配置了dns为8.8.8.8,使用阿里的yum源

拉取Git源码

git clone https://ghproxy.com/https://github.com/git/git.git

这里使用了加速站点进行加速拉取源码

编译安装

cd git
make prefix=/usr all
make prefix=/usr install

这里编译并安装到了/usr/bin

配置TAB提示

cp contrib/completion/git-completion.bash ~/.git-completion.bash
cat >> ~/.bash_profile <<EOF
if [ -f ~/.git-completion.bash ]; thensource ~/.git-completion.bash
fi
EOF
source ~/.git-completion.bash

gitlab-runner可以没有TAB提示,但是我不能没有

校验版本

git version

就可以看到是最新的Git了
在这里插入图片描述

一键脚本

#!/usr/bin/bash
echo "nameserver 8.8.8.8" >> /etc/resolv.conf
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum install git curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker -y
git clone https://ghproxy.com/https://github.com/git/git.git
cd git
make prefix=/usr all
make prefix=/usr install
cp contrib/completion/git-completion.bash ~/.git-completion.bash
cat >> ~/.bash_profile <<EOF
if [ -f ~/.git-completion.bash ]; thensource ~/.git-completion.bash
fi
EOF
source ~/.git-completion.bash
http://www.lryc.cn/news/115303.html

相关文章:

  • 【Linux】计算机网络的背景和协议分层
  • 代理模式:静态代理+JDK/CGLIB 动态代理
  • gps虚拟定位 AnyGo for Mac 中文
  • LLM reasoners 入门实验 24点游戏
  • 【LeetCode 算法】Maximum Absolute Sum of Any Subarray 任意子数组和的绝对值的最大值-前缀和
  • 怎么建立大型语言模型
  • docker简介和安装
  • 记录问题: servlet获取项目包绝对路径
  • C语言文件操作基本方法
  • SQL 相关子查询 和 不相关子查询、Exists 、Not Exists、 多表连接(包含自连接)
  • 项目规范 编写规范(范例)
  • MongoDB数据库操作及操作命令
  • Linux命令(62)之tee
  • 搭建Repo服务器
  • 安卓:MMKV——键值存储库
  • 使用Python将图像转换为PDF:一次性解决您的批量转换需求
  • Vue——webpack
  • springboot房地产管理java购房租房二手房j客户sp源代码mysql
  • Gartner 发布影响数据科学和机器学习未来方向重要趋势
  • 72. 编辑距离
  • Android12.0 原生系统SystemUI下拉状态栏和通知栏视图之锁屏通知布局
  • 周末在家值班,解决几个月前遗忘的Bug
  • Shell编程基础(十五)文本三剑客(sed)
  • 5,二叉树【p6-p7】
  • 【Spring】如果你需要使用重试机制,请使用Spring官方的Spring Retry
  • pagehelper 优化自定义分页和排序位置
  • Linux下查询文件夹中文件数量的方法
  • PS透明屏,在科技展示中,有哪些优点展示?
  • Hbase-面试题
  • 图的宽度优先深度优先遍历