惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Stack Overflow Blog
Stack Overflow Blog
量子位
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
美团技术团队
小众软件
小众软件
aimingoo的专栏
aimingoo的专栏
Recent Announcements
Recent Announcements
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Microsoft Security Blog
Microsoft Security Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
酷 壳 – CoolShell
酷 壳 – CoolShell
J
Java Code Geeks
V
V2EX
大猫的无限游戏
大猫的无限游戏
D
DataBreaches.Net
博客园 - Franky
爱范儿
爱范儿
T
Tailwind CSS Blog
A
About on SuperTechFans
Google DeepMind News
Google DeepMind News
博客园_首页
B
Blog RSS Feed
博客园 - 司徒正美
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知

jdhao's digital space

Conversion between base64 and OpenCV or PIL Image 腾讯云对象存储博客图床开启 CDN 加速(不需要购买额外域名) Search and Replace in Multiple Files in Vim/Neovim Change Table Column Width in LaTeX Image or Table Side by Side in LaTeX LaTeX 并排显示图像或表格 Firenvim: Neovim inside Your Browser Content inside HTML tags missing in Latest Hugo? Creating Markdown Front Matter with Ultisnips Labelme JSON 标注格式转 voc XML 格式 Nifty Nvim Techniques That Make My Life Easier -- Series 6 macOS 下如何为视频制作字幕 Running Command Asynchronously inside Neovim Resolving Merge Conflict after Git Stash Pop Pylint: command not found? A Hands-on Experience with Neovim's Built-in LSP Support How to Convert PDF to Images with Imagemagick 互联网上常用缩略语集锦 File Backup in Neovim Converting PDF Pages to Images with Poppler Nifty Nvim Techniques That Make My Life Easier -- Series 5 Neovim Configuration for System-wide Use How to sort a list of tuple or list in Python -- lambda or itemgetter? Building A Vim Statusline from Scratch 人类第一颗原子弹爆炸始末 Distributed Training in PyTorch with Horovod Learning Expect Programming Essential Knowledge about SSH Nifty LaTeX Techniques -- Series 1 更改 Adsense 邮寄地址,重新寄送 PIN
How To Install Latest Version of Git on Linux
2021-03-27 · via jdhao's digital space
Update log

2021-12-10: update endpoint rpm link for git

The version of the default git bundled with the Linux system is often too old, and lacks certain features, which may break some tools. This post summarizes how to install newer versions of Git on Linux.

Install via package manager#

CentOS#

If you have root rights, you can install new version of git via yum.

# https://ius.io/setup
yum install \
https://repo.ius.io/ius-release-el7.rpm \
https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

yum remove git
yum install git224

The version of git installed is 2.24.4.

The following also work:

yum -y install https://packages.endpointdev.com/rhel/7/os/x86_64/endpoint-repo.x86_64.rpm
yum remove git
yum install git

Compile and install git from source#

First, we need to install some dependency packages. Note that if we use https protocol for git, we need to install curl development package:

yum install libcurl-devel

Otherwise, when you git clone using a https url: git clone https://xxx.xx.xx, you get an error:

git: ‘remote-https’ is not a git command. See ‘git –help’.

If you do not have root rights, you can also build curl from source.

Then, run the following script to build git from source:

wget https://github.com/git/git/archive/refs/tags/v2.31.1.tar.gz -O git.tar.gz
tar xvf git.tar.gz
cd git-*
mkdir -p $HOME/local
make configure
./configure --prefix=$HOME/local
make -j && make install

git will be installed under $HOME/local/bin. Then, add $HOME/local/bin to your PATH:

export PATH="$HOME/local/bin:$PATH"

Run git --version to check the git version.

Ref: