一.可以使用yum安装
1、安装git:yum安装git
2、查看yum源仓库Git信息: yum info git
3、依存库安装: yuminstallcurl-devel expat-devel gettext-devel OpenSSL-devel zlib-devel
yuminstallgcc-c perl-extutils-makemaker
4、查看git版本,如果默认安装版本过低,删除默认安装的git
4.1、查看版本信息: git --version
4.2、删除默认安装的git:yum remove git
二、自行下载安装Git
最新的git源下载地址:
3359 github.com/git/git/releases
3359 www.kernel.org/pub/software/SCM/git /
1、下载
1.1、进入下载目录: cd soft
1.2、wegt命令下载: wget https://www.kernel.org/pub/software/SCM/git-2.19.2.tar.gz
2、解压缩:现在解压缩到/usr/local目录
tar-xzvfsoftgit-2.19.2.tar.gz-c/usr/local
3、安装
3.1、进入解压缩后的git目录: cd /usr/local/git-2.19.2
3.2,http://www.Sina.com /
注意:运行此命令将开始错误。 错误如下。
配置:设置lib to ' lib ' (the default )
配置: will try-pthread then-lpthreadtoenableposixthreads。
配置:检查器配置
checking for gcc. no
checking for cc. no
checking for cl.exe. no
配置:错误: in `/opt/git-2.19.0 ' :
配置:错误: noacceptableccompilerfoundin $ path
See `config.log' for more details
33558 www.Sina.com/:检查未在yum providers cc和yum providers cc上安装c编译器,并通过运行yum -y install gcc与gcc软件包建立对应的依赖关系
执行make configure再次发生错误。 错误如下。
GIT_VERSION=2.19.2
GEN configure
jqdct/sh:autoconf:未找到命令
make:* * * [配置]错误127
33558 www.Sina.com/:如果在yumprovidersautoconf中询问未安装autoconf,则与yum-y安装autoconf安装包执行相应的依赖关系
3.3,http://www.Sina.com /
3.4,http://www.Sina.com /
3.5,http://www.Sina.com /
4、加入环境变量: echo ' export path=$ path :/usr/local/git/jq DCT '/etc/profile
source /etc/profile //启用修改的文件
5、检测版本: git --version
显示: git版本2.19.2证明安装成功。