git status 仅列出一项:master
p>git remote -v 列出了两个条目到同一个地址:一个用于提取,一个用于推送
但是当我执行 git remote show origin 或其他操作时,例如 fetch ,我得到:
错误:访问https时:... 致命错误:HTTP请求失败我在代理之后,但是它在我的.gitconfig(sslVerify = no)中设置,克隆是好的,我不认为问题来自于此。
但是...我的操作系统(CentOS)已被重新安装。
<如果您使用 https:而不是 git: $ c>作为你的克隆,它可能会在CA证书上出现问题,即你没有中间证书的副本来验证你的SSL连接。我遇到过几次不同的场合。通常使用基于Debian的Linux发行版。尝试 git config --global http.sslVerify false,然后再次克隆。如果克隆工作,那就是发生了什么。然而,这是一个不好的解决方案,因为当然会关闭SSL验证,这使得使用HTTPS毫无意义,并且容易受到中间人攻击。
你需要做的是下载CA Certificates软件包,以查看你在Linux下的任何操作系统(以及Debian / Ubuntu),它可能类似于
then git config --global http.sslVerify true git config --global http.sslCAinfo / etc / ssl / certs / ca-证书.crt尽管您的证书文件路径可能会因操作系统版本而有所不同。
这应该起作用。
I have a remote repository with HTTPS access.
git status lists only one entry: master
git remote -v lists two entries to the same address: one for fetch, one for push
But when I do git remote show origin, or other operations, like fetch, I get :
error: while accessing https:... fatal: HTTP request failedI am behind a proxy, but as it is set in my .gitconfig (sslVerify = no) and the cloning is OK, I don't think the problem comes from that.
BUT... my OS (CentOS) has been reinstalled.
解决方案If you're using https: rather than git: for your clone, it's possible that it's barfing on the CA certificate, i.e. you don't have a copy of the intermediate certificate to verify your SSL connection. I've run into this on a couple of different occasions. Usually with debian-based Linux distributions. Try
git config --global http.sslVerify falseand then the clone again. If the clone works, that's what's happening. However this is a bad solution, as of course turns off SSL verification, which makes using HTTPS somewhat pointless, and leaves you vulnerable to man-in-the-middle attacks.
What you need to do is download the CA Certificates package for whatever OS you're on, under Linux (well Debian/Ubuntu) it'll probably be something like
apt-get install ca-certificatesthen
git config --global http.sslVerify true git config --global http.sslCAinfo /etc/ssl/certs/ca-certificates.crtalthough your path to your certificate file might be different depending on OS version.
This should get it working.
更多推荐
Git:HTTP请求失败
发布评论