git升级编译安装

一、删除旧版本git

方法一、

yum remove git -y  (centos环境)

apt-get remove git -y (Ubuntu环境)

 

方法二、 which git 

[root@park2-0007 ~]# which -a git
/usr/bin/git
/bin/git
[root@park2-0007 ~]# mv /usr/bin/git* /tmp/bakgit/

二、下载符合要求的git源码包

下载地址: https://github.com/git/git/tags

三、编译安装git

## 源码包解压缩
tar xf git-2.30.7.tar.gz -C /usr/local/src/
cd /usr/local/src/git-2.30.7
make configure
./configure --prefix=/usr/local/git --with-openssl=/bin/openssl
make
make install
echo  "export PATH=$PATH:/usr/local/git/bin" >> /etc/profile
source /etc/profile

 

 注意:

  make过程中可能出现如下错误,原因是openssl的路径设置不对

 

 所以需要在./configure时指定,默认的openssl的路径时/usr/bin/openssl。

 

posted @ 2023-01-28 15:23  高佳丰  阅读(217)  评论(0编辑  收藏  举报