Linux离线安装git

  • Post author:
  • Post category:linux


我们也可以在官网下载源码包来安装,最新源码包下载地址


Index of /pub/software/scm/git/ (kernel.org)

安装指定系统的依赖包:

########## Centos/RedHat ##########
$ yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel 

########## Debian/Ubuntu ##########
$ apt-get install libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev

解压安装下载的源码包:

$ tar -zxf git-2.34.1.tar.gz
$ cd git-2.34.1
$ make prefix=/usr/local all
$ sudo make prefix=/usr/local install

环境变量配置:

vi /etc/profile添加–>export PATH=$PATH:/usr/local/git/bin

让该配置文件立即生–>source /etc/profile

验证:git –version



版权声明:本文为JDBogdan原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。