我被困在防火墙后面,所以必须使用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,否则我就完了。


当前回答

你看时间了吗?

我绝对拒绝让我的git操作变得不安全,在尝试了人们在这里提到的所有东西之后,我突然发现,证书无法通过验证的一个可能原因是日期错误(要么是证书过期日期,要么是本地时钟)。

您可以通过在终端中输入日期轻松地进行检查。在我的情况下(一台新的树莓派),本地时钟被设置为1970年,所以一个简单的ntpdate -u 0.ubuntu.pool.ntp.org修复了所有问题。对于rPi,我也建议你将以下脚本放在日常cron作业中(例如/etc/cron.daily/ntpdate):

#!/bin/sh
/usr/sbin/ntpdate -u 0.ubuntu.pool.ntp.org 1> /dev/null 2>&1

其他回答

尝试使用命令

git config --global http.sslverify false

该命令将允许来自http的所有不安全的证书,如果在专业环境中使用,请谨慎使用。

设置SSL验证为false时在windows上克隆:

    git -c http.sslVerify=false clone http://example.com/e.git

如果你想克隆而不无聊你的全局设置。

我有一份粗糙的PI

pi@raspbmc:~$ git克隆http: //github.com/andreafabrizi/Dropbox-Uploader .git 克隆到'Dropbox-Uploader'… 错误:SSL CA证书(路径?),同时访问http:// github.com/andreafabrizi/Dropbox-Uploader.git/info/refs fatal: HTTP请求失败

所以id a

sudo apt-get install ca-certificates

then

git clone http://github.com/andreafabrizi/Dropbox-Uploader.git  

工作

如果您想修复证书问题,请跳过这个答案。这个答案涉及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和git的证书,所以我做了@esquifit张贴的东西。然而,我不得不手动运行第5步,c_rehash在我的系统上不可用。我遵循了以下指南:将CA证书安装到OpenSSL框架中。