由于centos的yum安装的git还是1.7.1版本,导致git clone出现401错误:error: The requested URL returned error: 401 Unauthorized while accessing ,可以使用git --version查看版本。现在需要到github上获取最新版本编译安装。
先安装好依赖库
1 | yum -y install curl-devel expat-devel gettext-devel openssl-devel zlib-devel asciidoc |
卸载Centos自带的git1.7.1
1 | yum remove git |
下载git
1 | wget https://github.com/git/git/archive/v2.2.1.tar.gz |
编译安装
1 | tar -zxvf git-2.2.1.tar.gz |
查看版本
1 | git --version |
末尾
到这里,你可以快乐的git clone了