1.官网参考
git源码资源:
https://mirrors.edge.kernel.org/pub/software/scm/git/
安装参考:https://git-scm.com/book/zh/v2/%E8%B5%B7%E6%AD%A5-%E5%AE%89%E8%A3%85-Git
2.安装依赖
Git 依赖的库:autotools、curl、zlib、openssl、expat 和 libiconv
yum install dh-autoreconf curl-devel expat-devel gettext-devel openssl-devel perl-devel zlib-devel
为了添加文档的多种格式(doc、html、info),需要以下附加的依赖:
yum install asciidoc xmlto docbook2X
3.下载git源码
wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.9.5.tar.gz --no-check-certificate
tar zxvf git-2.9.5.tar.gz
cd git-2.9.5
4.编译安装git
./configure --prefix=/env/git/2.9.5
make & make install
make clean
5.添加全局变量
echo 'export PATH=$PATH:/env/git/2.9.5/bin' > /etc/profile.d/git.sh
git --version
6.记住用户名和密码
$ git config –global user.name “name”
$ git config –global user.email test@example.com
输入- -global 的时候, 用自己的键盘敲出来!
不要直接复制粘贴,直接复制粘贴就会报error: key does not contain a section: –global。