1. 程式人生 > >git clone 報錯:fatal: HTTP request failed

git clone 報錯:fatal: HTTP request failed

git

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

git clone 報錯:fatal: HTTP request failed