由于公司代理证书被更改,Git推送失败

时间:2012-10-23 09:55:24

标签: git curl https ssl-certificate ubuntu-12.04

最近,公司代理的证书已更改。从那以后,我一直面临着使用git的问题。当我尝试git push时,我收到以下错误:

error: gnutls_handshake() failed: The Diffie-Hellman prime sent by the server is not acceptable (not long enough). while accessing https://github.com/me/myproj.git/info/refs
fatal: HTTP request failed

我可以通过git config --global http.sslVerify false切换到使用HTTP推送或关闭sslVerify,但他们坚持我只使用 HTTPS。

我有一个 .cer 证书文件,我被要求在我的Ubuntu桌面(Ubuntu 12.04)中安装系统,但我找不到办法。请帮忙!

以下是我在执行export GIT_CURL_VERBOSE=1后获得的 curl 日志:

* Couldn't find host github.com in the .netrc file; using defaults
* About to connect() to proxy proxy.mycompany.com port 5150 (#0)
*   Trying 10.226.xx.yyy... * Connected to proxy.mycompany.com (10.226.xx.yyy) port 5150 (#0)
* Establish HTTP proxy tunnel to github.com:443
* Proxy auth using Basic with user 'me'
> CONNECT github.com:443 HTTP/1.1
Host: github.com:443
Proxy-Authorization: Basic MjQABCD3Og==
User-Agent: git/1.7.9.5
Proxy-Connection: Keep-Alive
Pragma: no-cache

< HTTP/1.1 200 Connection established
< Date: Tue, 23 Oct 2012 11:45:37 GMT
< Age: 0
< Proxy-Connection: Keep-Alive
< Via: 1.0 MYCOMPANYSERVER.MYCOMPANY.COM
< 
* Proxy replied OK to CONNECT request
* found 1 certificates in /etc/ssl/certs/cert.crt
* gnutls_handshake() failed: The Diffie-Hellman prime sent by the server is not acceptable (not long enough).
* Closing connection #0
* Couldn't find host github.com in the .netrc file; using defaults
* About to connect() to proxy proxy.mycompany.com port 5150 (#0)
*   Trying 10.226.xx.yyy... * Connected to proxy.mycompany.com (10.226.xx.yyy) port 5150 (#0)
* Establish HTTP proxy tunnel to github.com:443
* Proxy auth using Basic with user 'me'
> CONNECT github.com:443 HTTP/1.1
Host: github.com:443
Proxy-Authorization: Basic MjQABCD3Og==
User-Agent: git/1.7.9.5
Proxy-Connection: Keep-Alive
Pragma: no-cache

< HTTP/1.1 200 Connection established
< Date: Tue, 23 Oct 2012 11:45:37 GMT
< Age: 0
< Proxy-Connection: Keep-Alive
< Via: 1.0 MYCOMPANYSERVER.MYCOMPANY.COM
< 
* Proxy replied OK to CONNECT request
* found 1 certificates in /etc/ssl/certs/cert.crt
* gnutls_handshake() failed: The Diffie-Hellman prime sent by the server is not acceptable (not long enough).
* Closing connection #0
error: gnutls_handshake() failed: The Diffie-Hellman prime sent by the server is not acceptable (not long enough). while accessing https://github.com/me/myproject.git/info/refs
fatal: HTTP request failed

1 个答案:

答案 0 :(得分:1)

您的连接使用/etc/ssl/certs/cert.crt作为证书。

您可以尝试在/etc/ssl/certs/下复制您拥有的证书文件,然后以root用户身份在该目录中提供命令c_rehash .(注意点!)。