主页 > IT业界  > 

源码安装git

源码安装git

系统: Centos

由于系统自带的yum源仓库的git版本较低,所以在官网下载源码进行编译安装

官网地址: git-scm / 源码下载地址: github /git/git

安装旧版本的git拉去git源码(如果是上传到服务器就不用了下载git了)

[root@localhost ~]# yum -y install git

拉取git源码

[root@localhost ~]# git clone github /git/git.git

安装可能需要的依赖

[root@localhost ~]# yum -y install curl-devel expat-devel openssl-devel zlib-devel gcc-c++ [root@localhost ~]# yum -y install perl-ExtUtils-MakeMaker automake autoconf libtool make

编译安装

[root@localhost ~]# cd git/ [root@localhost ~]# make configure [root@localhost git]# ./configure --prefix=/usr/local/git # 安装在/usr/local目录下 [root@localhost git]# make && make install

卸载旧的git并将新安装的git设置环境变量

[root@localhost ~]# yum -y remove git [root@localhost ~]# echo 'export GIT_HOME=/usr/local/git' >> /etc/profile [root@localhost ~]# echo 'export PATH=$PATH:$GIT_HOME/bin' >> /etc/profile

加载配置文件,并查看git版本

[root@localhost ~]# source /etc/profile [root@localhost ~]# git version git version 2.43.0
标签:

源码安装git由讯客互联IT业界栏目发布,感谢您对讯客互联的认可,以及对我们原创作品以及文章的青睐,非常欢迎各位朋友分享到个人网站或者朋友圈,但转载请说明文章出处“源码安装git