摘要:网上说有三种原因,第一种是服务器时间,这个我改了。
第二种是git版本,这个更新起来太麻烦,确实这个原因是很有可能的,centos仓库中的git版本一直是1.7,最新的已经更新到2.1了。
第三种原因,我按照下方的命令更新了curl,还是有问题,所以说看起来是git版本的原因,这个有时间再抠这块。
————————————————————————————————
git clone 报错:fatal: HTTP request failed
2018年08月15日 20:49:17 it_liangsir 阅读数:145收起
个人分类: git clone
-
git clone https://github.com/xxxx/lilxxy.git
-
Initialized empty Git repository in /tmp/clone123/lxyily/.git/
-
error: while accessing https://github.com/xxxx/lxyily.git/info/refs
-
fatal: HTTP request failed
这个报错的原因可以能是:
1、服务器时间问题
2、git 版本问题
3、curl版本问题
对于3,因为git 在连接的时候内部其实是curl来连接。通过curl https://xxxx 发现也是报错,发现ssl 连接有问题
通过可以git clone的服务器对比发现出现故障的服务器的curl版本不一样。所以更新curl
yum update -y nss curl libcurl
CentOS安装最新版本GitHub
[日期:2017-01-20] | 来源:Linux社区 作者:nxstack | [字体:大 中 小] |
由于CentOS仓库中Git的版本没及时更新,一直停留在了1.7.1,但git最新版本已经到了2.x.x,对于想要获取最新git的系统,只能下rpm包或者用源码;具体方法如下操作:
一、下载编译工具
[root@localhost Desktop]# yum groupinstall "Development Tools"
二、下载依赖安装包
[root@localhost Desktop]# yum install zlib-devel perl-ExtUtils-MakeMaker asciidoc xmlto openssl-devel
三、下载 git 最新版本源代码
wget http://www.codemonkey.org.uk/projects/git-snapshots/git/git-latest.tar.gz
四、解压源文件
tar -zxvf git-latest.tar.gz
五、cd到源文件目录,编译安装
[root@localhost git-2017-01-03]# autoconf
[root@localhost git-2017-01-03]# ./configure
[root@localhost git-2017-01-03]# make && make install
六、【重要】添加link
[root@localhost git-2017-01-03]# ln -s /usr/local/bin/git /usr/bin/
如果提示如下:
[root@localhost git-2017-01-03]# ln -s /usr/local/bin/git /usr/bin/
ln: creating symbolic link `/usr/bin/git': File exists
请先删除/usr/bin/git
[root@localhost git-2017-01-03]# rm -rf /usr/bin/git
然后再次执行添加link命令
七、验证版本
[root@localhost git-2017-01-03]# git --version
git version 2.11.GIT
八、为了后续git https不报错,请在/etc/profile文件中添加环境变量
PATH=$PATH:/usr/libexec/git-core