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