yum升級git 服務器上的git版本過低,不少東西不能用了,要升級git版本
廢話很少,直接上腳本的,初級的運維均可以看懂!git
#!/bin/bash if [ ! -d /home/tools/ ];then mkdir -p /home/tools else rm -rf /home/tools && mkdir -p /home/tools fi cd /home/tools yum update -y yum -y install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker cd /home/tools wget -c https://www.kernel.org/pub/software/scm/git/git-2.9.5.tar.gz if [ $? -eq 0 ];then tar zxvf git-2.9.5.tar.gz fi cd git-2.9.5 && make prefix=/usr/local/git all && make prefix=/usr/local/git install if [ $? -eq 0 ];then rm -rf /usr/bin/git ln -s /usr/local/git/bin/git /usr/bin/git else exit 1 fi git --version