About git unable to clone the library whose address is https

1. Problem description

When I was studying "Spark Fast Big Data Analysis" in the morning, I needed to download the example code of the book, so I used git clone to give the library:

https://github.com/databricks/learning-spark.git

As a result, the clone could not be successfully cloned, and the final error output was " git https fatal: HTTP request failed ".

 

Second, the solution process

I found it online. One solution is to use git: or ssh: instead of https:, such as the solution given by github's official website: https://help.github.com/articles/using-ssh-over-the-https-port / , I did this and it worked, but it didn't work, I got "Error: Permission denied (publickey)" and I still couldn't clone. Forget it.

 

So I continued to use the https link, and learned that git uses curl as its https transmission client, and an environment variable needs to be set:

export GIT_CURL_VERBOSE=1
https://github.com/databricks/learning-spark.git

There is still an error. First of all, github.com cannot be pinged. After a search on the Internet, it can be set to another address: 192.30.253.113, which can be pinged, so add:

192.30.253.113 github.com

There is also a certificate problem, set it up:

git config --global http.sslverify true
git config --global http.sslCAPath /etc/pki/tls/certs

 

Re-operation still reports an error, this time it is "failed to load from ... CURLOPT_CAPATH" and "NSS error -12286", it is guessed that it is a configuration problem of curl.

Finally, I learned through an article that it should be a cipher problem, https://bugs.centos.org/view.php?id=5620 , in which a comment said:

Yes there is and this is not a bug, it's just that in the latest version curl doesn't have RC4-SHA enabled by defaul.

Test it as it says:

curl --cipher rsa_rc4_128_sha https://github.com/databricks/learning-spark.git

Then. . . Indicates that there is no such cipher, and finally prompted "curl: (35) SSL connect error", through this information, found another blog post, saying that nss needs to be upgraded first:

yum update nss

After the upgrade, re-cloned the target library, and finally got it! ! !

 

3. Summary

In fact, in the process of solving the problem, I stepped on a lot of pits, mainly because I did not grasp the most important error message and went around in a circle. But a very important idea is to ask a few more whys when encountering a problem. What are the main characteristics of the problem? What is the source of the problem? How many solutions are there? Which is more suitable? To clarify each link, and then to eliminate each problem, the problem can be solved in the end. Of course, if it is not solved, there will be no this article.

 

4. Reference

1. git and HTTPS (fatal: HTTP request failed)

2. Using SSH over the HTTPS port

3. The solution to curl: (35) SSL connect error

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325207049&siteId=291194637