linux修改升级git插件版本

git版本升级

1、查看本地git版本

[root@jenkins ~]# git --version
git version 1.7.1

2、卸载本机低版本的git,自行安装更高版本的git

[root@jenkins ~]# yum remove -y git            //或者使用"rpm -e --nodeps git"命令进行卸载
[root@jenkins ~]# git --version   
-bash: /usr/bin/git: No such file or directory

3、进行git版本升级操作:下载并安装高版本的git

下载地址:https://mirrors.edge.kernel.org/pub/software/scm/git/

[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

4、添加git到环境变量

[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

5、查看更新后的git版本和所在路径

[root@jenkins ~]# git --version
git version 2.1.1
[root@jenkins ~]# whereis git
git: /usr/local/git

你可能感兴趣的:(git)