How To Install Latest Version of Git on Linux
source link: https://jdhao.github.io/2021/03/27/upgrade_git_on_linux/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
How To Install Latest Version of Git on Linux
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.endpoint.com/rhel/7/os/x86_64/endpoint-repo-1.7-1.x86_64.rpm
yum remove git
yum install git
Compile and install git from source
If you would like to install git from source. Run the following script:
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.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK