我被困在防火墙后面,所以必须使用HTTPS访问我的GitHub存储库。我在Windows XP上使用cygwin 1.7.7。

我试过把遥控器设置为https://username@github.com/username/ExcelANT.git,但按下输入密码的提示,但输入后没有任何反应。 https://username:<密码>github.com/username/ExcelANT.git和克隆空回购从零开始,但每次它给我同样的错误

错误:SSL证书有问题,请检查CA证书是否正确。细节: SSL例程:SSL3_GET_SERVER_CERTIFICATE:访问https://github.com/username/ExcelANT.git/info/refs时证书验证失败

打开GIT_CURL_VERBOSE=1会给我

* About to connect() to github.com port 443 (#0) * Trying 207.97.227.239... * successfully set certificate verify locations: * CAfile: none CApath: /usr/ssl/certs * SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed * Expire cleared * Closing connection #0 * About to connect() to github.com port 443 (#0) * Trying 207.97.227.239... * successfully set certificate verify locations: * CAfile: none CApath: /usr/ssl/certs * SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed * Expire cleared * Closing connection #0 error: SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed while accessing https://github.com/username/ExcelANT.git/info/refs

fatal: HTTP request failed

这是我的防火墙有问题吗,cygwin还是什么?

我没有在Git配置中设置HTTP代理,但是它是一个ISA服务器,需要NTLM身份验证,不是基本的,所以除非有人知道如何强制Git使用NTLM,否则我就完了。


当前回答

如果你使用的是基于debian的操作系统,你可以简单地运行

安装ca-certificates

其他回答

在CentOS 5上。X,一个简单的yum update openssl更新了openssl包,更新了系统ca-bundle。CRT文件,帮我解决了这个问题。

其他发行版可能也是如此。

如果您想修复证书问题,请跳过这个答案。这个答案涉及ssh通过防火墙的隧道,这是一个更好的解决方案来处理防火墙/代理的事情。

有一个比使用http访问更好的方法,那就是使用ssh服务提供的github端口443的ssh.github.com服务器。

我们使用一种叫做开瓶器的工具。这对于CygWin(通过CygWin主页上的设置)和使用您喜欢的打包工具的Linux都是可用的。对于MacOSX,至少可以从macports和brew中获得。

命令行如下:

$ corkscrew <proxyhost> <proxyport> <targethost> <targetport> <authfile>

proxyhost和proxyport是https代理的坐标。targethost和targetport是要进行隧道连接的主机的位置。authfile是一个文本文件,其中一行包含您的代理服务器用户名/密码,由冒号分隔

e.g:

abc:very_secret

安装使用“正常”的ssh协议进行git通信

通过将其添加到~/。Ssh /config这个技巧可以用于正常的Ssh连接。

Host github.com
  HostName ssh.github.com
  Port 443
  User git
  ProxyCommand corkscrew <proxyhost> <proxyport> %h %p ~/.ssh/proxy_auth

现在您可以通过ssh-ing到gitproxy来测试它的工作

pti@pti-laptop:~$ ssh github.com
PTY allocation request failed on channel 0
Hi ptillemans! You've successfully authenticated, but GitHub does not provide shell access.
       Connection to github.com closed.
pti@pti-laptop:~$

(注意:如果你以前从未登录过github, ssh会要求将服务器密钥添加到已知的hosts文件中。如果你是偏执狂,建议将RSA指纹验证为你上传密钥的github网站上显示的指纹)。

当你需要使用另一个密钥访问存储库时,这种方法有一个轻微的变体,例如,将你的私人帐户与你的专业帐户分开。

# 
# account dedicated for the ACME private github account 
#
Host acme.github.com
  User git
  HostName ssh.github.com
  Port 443
  ProxyCommand corkscrew <proxyhost> <3128> %h %p ~/.ssh/proxy_auth
  IdentityFile ~/.ssh/id_dsa_acme

享受吧!

我们已经在Linux、mac和Windows上使用它很多年了。

如果你愿意,你可以在这篇博客文章中阅读更多有关它的内容

问题是您的系统上没有安装任何证书颁发机构证书。这些证书不能用cygwin的setup.exe安装。

更新:在cygwin安装Net/ca-certificates包(感谢dirkjot)

有两种解决方案:

实际安装根证书。Curl从Mozilla中为您提取证书。

cacert。Pem文件就是你要找的。该文件包含> 250个CA证书(不知道如何信任这个数量的ppl)。你需要下载这个文件,把它分解成单独的证书,把它们放到/usr/ssl/certs(你的CApath)并索引它们。

以下是如何做到这一点。使用cygwin setup.exe安装curl和openssl包 执行:

<!-- language: lang-bash -->

    $ cd /usr/ssl/certs
    $ curl http://curl.haxx.se/ca/cacert.pem |
      awk '{print > "cert" (1+n) ".pem"} /-----END CERTIFICATE-----/ {n++}'
    $ c_rehash

重要提示:为了使用c_rehash,你也必须安装openssl-perl。

Ignore SSL certificate verification. WARNING: Disabling SSL certificate verification has security implications. Without verification of the authenticity of SSL/HTTPS connections, a malicious attacker can impersonate a trusted endpoint (such as GitHub or some other remote Git host), and you'll be vulnerable to a Man-in-the-Middle Attack. Be sure you fully understand the security issues and your threat model before using this as a solution. $ env GIT_SSL_NO_VERIFY=true git clone https://github...

对于那些使用Msys/MinGW GIT的用户,添加这个

  export GIT_SSL_CAINFO=/mingw32/ssl/certs/ca-bundle.crt 

我也有同样的问题。 证书导入或取消ssl验证的命令不起作用。 原来是过期的网络代理密码。 代理配置条目。在我的Windows用户配置文件中的.gitconfig文件中。 我只是删除了整个条目,它又开始工作了。