Skip to content

Instantly share code, notes, and snippets.

@BTabaku
Last active November 10, 2023 09:12
Show Gist options
  • Save BTabaku/b85d195ac5e4a0ba05cbd2745b9d608a to your computer and use it in GitHub Desktop.
Save BTabaku/b85d195ac5e4a0ba05cbd2745b9d608a to your computer and use it in GitHub Desktop.
Installing / upgrading git manually on CentOS 7
#!/bin/bash
# Install the required Perl module
sudo cpan ExtUtils::MakeMaker
# Remove the old Git
sudo yum remove git
# Download the latest Git sources
wget https://github.com/git/git/archive/refs/tags/v2.35.1.tar.gz
# Extract the downloaded file
tar -xzf v2.35.1.tar.gz
# Navigate to the extracted directory
cd git-2.35.1
# Compile and install Git
make prefix=/usr/local all
sudo make prefix=/usr/local install
# Add the path of the new Git binary to the .bashrc file
echo 'export PATH=/usr/local/bin:$PATH' >> ~/.bashrc
# Source the .bashrc file for the changes to take effect
source ~/.bashrc
# Check the Git version
git --version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment