git克隆时连接中出现未知SSL协议错误
我必须通过代理访问internet,因此请在我的环境中配置以下内容:git克隆时连接中出现未知SSL协议错误,git,ssl,curl,proxy,openssl,Git,Ssl,Curl,Proxy,Openssl,我必须通过代理访问internet,因此请在我的环境中配置以下内容: export https_proxy=https://proxy.xxx.xxx:xxx 但当我通过“https”链接从github(或任何其他git repo)克隆代码时,我得到了错误: sunyi-ubuntu# git clone https://github.com/git/git.git fatal: unable to access 'https://github.com/git/git.git/': Unkno
export https_proxy=https://proxy.xxx.xxx:xxx
但当我通过“https”链接从github(或任何其他git repo)克隆代码时,我得到了错误:
sunyi-ubuntu# git clone https://github.com/git/git.git
fatal: unable to access 'https://github.com/git/git.git/': Unknown SSL protocol error in connection to github.com:443
但是,奇怪的是,只要我在git clone
之前运行curl
,它就可以工作,如下所示:
sunyi-unbunt:~# git clone https://github.com/git/git.git
Cloning into 'git'...
fatal: unable to access 'https://github.com/git/git.git/': Unknown SSL protocol error in connection to github.com:443
sunyi-ubuntu:~# curl https://github.com/git/git.git >& /dev/null
sunyi-ubuntu:~# git clone https://github.com/git/git.git
Cloning into 'git'...
remote: Enumerating objects: 138, done.
remote: Counting objects: 100% (138/138), done.
remote: Compressing objects: 100% (74/74), done.
Receiving objects: 0% (1/271365)
我正在使用Ubuntu 16.04.3
我安装了libcurl4openssl开发工具
我构建并安装了最新的git源代码。
下面是我导出GIT\u CURL\u VERBOSE=1时的日志
Cloning into 'git'...
* Couldn't find host github.com in the .netrc file; using defaults
* Trying 10.239.4.80...
* Connected to proxy.xxx.xxx (10.239.4.80) port xxx (#0)
* Establish HTTP proxy tunnel to github.com:443
> CONNECT github.com:443 HTTP/1.1
Host: github.com:443
User-Agent: git/2.22.0.545.g9c9b961
Proxy-Connection: Keep-Alive
< HTTP/1.1 407 Proxy Authentication Required
< Proxy-Authenticate: NEGOTIATE
< Proxy-Authenticate: NTLM
< Proxy-Authenticate: BASIC realm="CORP_AD"
< Cache-Control: no-cache
< Pragma: no-cache
< Content-Type: text/html; charset=utf-8
< Proxy-Connection: close
< Connection: close
< Content-Length: 849
<
* Ignore 849 bytes of response-body
* Connect me again please
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
* CAfile: /etc/ssl/certs/ca-certificates.crt
CApath: /etc/ssl/certs
* Unknown SSL protocol error in connection to github.com:443
* Closing connection 0
* Couldn't find host github.com in the .netrc file; using defaults
* Hostname proxy.xxx.xxx was found in DNS cache
* Trying 10.239.4.80...
* Connected to proxy.xxx.xxx (10.239.4.80) port 914 (#1)
* Establish HTTP proxy tunnel to github.com:443
> CONNECT github.com:443 HTTP/1.1
Host: github.com:443
User-Agent: git/2.22.0.545.g9c9b961
Proxy-Connection: Keep-Alive
< HTTP/1.1 407 Proxy Authentication Required
< Proxy-Authenticate: NEGOTIATE
* gss_init_sec_context() failed: : SPNEGO cannot find mechanisms to negotiate
< Proxy-Authenticate: NTLM
< Proxy-Authenticate: BASIC realm="CORP_AD"
< Cache-Control: no-cache
< Pragma: no-cache
< Content-Type: text/html; charset=utf-8
< Proxy-Connection: close
< Connection: close
< Content-Length: 849
<
* Received HTTP code 407 from proxy after CONNECT
* Closing connection 1
fatal: unable to access 'https://github.com/git/git.git/': Unknown SSL protocol error in connection to
github.com:443
克隆到“git”。。。
*在.netrc文件中找不到主机github.com;使用默认值
*正在尝试10.239.4.80。。。
*连接到proxy.xxx.xxx(10.239.4.80)端口xxx(#0)
*建立到github.com的HTTP代理隧道:443
>连接github.com:443http/1.1
主持人:github.com:443
用户代理:git/2.22.0.545.g9c9b961
代理连接:保持活动状态
连接github.com:443http/1.1
主持人:github.com:443
用户代理:git/2.22.0.545.g9c9b961
代理连接:保持活动状态
=======已更新========
我已经尝试了上面提到的几乎每一个选项,没有人工作。
但是我刚刚找到了一种解决方法,在运行curl
之后,无论给curl指定什么类型的参数,git都能很好地工作。
因此,以下别名对我来说总是很好:
别名git='curl u>&/dev/null&git'
但我仍然好奇这个问题的根源 HTTP/1.1407需要代理身份验证hi@phd,是的。但这就是问题所在,为什么git会抱怨呢?我在第2页的回答中发现了一个类似的问题,我只是用Chrome浏览器浏览了一下网站就解决了这个问题。然后我又回到Git Bash,为了清晰起见,它立即起了作用,我的Git存储库URL看起来像,我浏览到了“HTTP/1.1407代理身份验证要求hi@phd,是的。”。但这就是问题所在,为什么git会抱怨呢?我在第2页的回答中发现了一个类似的问题,我只是用Chrome浏览器浏览了一下网站就解决了这个问题。然后我又回到Git Bash,为了清晰起见,它立即工作了,我的Git存储库URL看起来像,我浏览了```