git clone 报错:fatal: HTTP request failed

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

这里nss是默认使用ssl认证方式,当然也可以改成openssl的方式。查看是否是nss或者OpenSSL认证的方式为

 curl -V
curl 7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.27.1 zlib/1.2.3 libidn/1.18 libssh2/1.4.2
Protocols: tftp ftp telnet dict ldap ldaps http file https ftps scp sftp 
Features: GSS-Negotiate IDN IPv6 Largefile NTLM SSL libz 

如果需要改成OpenSSL的方式,可以参考网络上的

https://www.cnblogs.com/showker/p/4706271.html

猜你喜欢

转载自blog.csdn.net/qq_21918145/article/details/81710829