参考文档
https://git-scm.com/book/zh/v1/起步-安装-Git
git可以在https://github.com/git/git/releases下载
也可以在https://www.kernel.org/pub/software/scm/git下载
确认当前没有装过git的rpm包(如有则卸载)
yum remove git
|---|----------------| | 1 | yum remove git |
安装所需依赖
yum -y install curl-devel expat-devel gettext-devel openssl-devel zlib zlib-devel gcc perl-ExtUtils-MakeMaker wget
|---|--------------------------------------------------------------------------------------------------------------------| | 1 | yum -y install curl-devel expat-devel gettext-devel openssl-devel zlib zlib-devel gcc perl-ExtUtils-MakeMaker wget |
下载编译git
cd /usr/local/src/ wget https://www.kernel.org/pub/software/scm/git/git-2.13.4.tar.gz tar zxf git-2.13.4.tar.gz cd git-2.13.4 make prefix=/usr/local/git all make prefix=/usr/local/git install
|-------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | 1 2 3 4 5 6 | cd /usr/local/src/ wget https://www.kernel.org/pub/software/scm/git/git-2.13.4.tar.gz tar zxf git-2.13.4.tar.gz cd git-2.13.4 make prefix=/usr/local/git all make prefix=/usr/local/git install |
添加git变量
echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/bashrc source /etc/bashrc
|-----|---------------------------------------------------------------------------------| | 1 2 | echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/bashrc source /etc/bashrc |
查看git版本
git --version
|---|---------------| | 1 | git --version |