查看本机的git版本
1 2 | [root@jenkins ~] # git --version git version 1.7.1 |
卸载本机低版本的git,自行安装更高版本的git
1 2 3 | [root@jenkins ~] # yum remove -y git //或者使用"rpm -e --nodeps git"命令进行卸载 [root@jenkins ~] # git --version - bash : /usr/bin/git : No such file or directory |
接着进行git版本升级操作:下载并安装高版本的git,下载地址:https://mirrors.edge.kernel.org/pub/software/scm/git/
1 2 3 4 5 6 7 8 | [root@jenkins ~] # yum -y install libcurl-devel expat-devel curl-devel gettext-devel openssl-devel zlib-devel [root@jenkins ~] # yum -y install gcc perl-ExtUtils-MakeMaker [root@jenkins ~] # cd /usr/local/src/ [root@jenkins src] # wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.1.1.tar.gz [root@jenkins src] # tar -zvxf git-2.1.1.tar.gz [root@jenkins src] # cd git-2.1.1 [root@jenkins git-2.1.1] # make prefix=/usr/local/git all [root@jenkins git-2.1.1] # make prefix=/usr/local/git install |
添加git到环境变量
1 2 | [root@jenkins git-2.1.1] # echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/bashrc [root@jenkins git-2.1.1] # source /etc/bashrc |
查看更新后的git版本和所在路径
1 2 3 4 | [root@jenkins ~] # git --version git version 2.1.1 [root@jenkins ~] # whereis git git: /usr/local/git |