Upgrade Git on the server, but the git version in the default YUM source is too old, so you can only install it by compiling source code
- Check the existing Git version
Git version or git --versionCopy the code
- You can run the yum info git command to check the git version in the yum source. If you want to install git, you can use yum to install git.
yum install -y git
Copy the code
- Uninstall older versions of Git
yum remove git
Copy the code
- Install git’s dependent libraries
yum install -y curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker
Copy the code
- Download a higher version of Git, such as:
Wget https://github.com/git/git/archive/v2.9.2.tar.gz tar - ZXVF git - 2.9.2. Tar. GzCopy the code
- Go to the directory and compile and install
cdGit - 2.9.2. / configure -- prefix = / usr /local/git // check the dependencies and set the installation path make & make install // compile the installationCopy the code
- Configure global environment variables
vim /etc/profile
export GIT_HOME=/usr/local/git
export PATH=$PATH:$GIT_HOME/bin
source/etc/profile./ Refresh permissionCopy the code
- Check if it is the specified version of the installation
git version
Copy the code