简体   繁体   English

适用于Windows的Git - 通过https克隆失败

[英]Git for Windows - clone over https failing

UPDATE 2018-02-26 更新 2018-02-26

Got ssh working instead. 得到了ssh工作。

I'd still be interested to know why the https call failed. 我仍然有兴趣知道https调用失败的原因。


Any help on where to look next to allow cloning via https? 有关下一步可以通过https进行克隆的任何帮助吗? (Cannot use ssh, port is blocked) (不能使用ssh,端口被阻止)

OS OS

Windows Server 2012 R2 Standard Windows Server 2012 R2标准版

Install location 安装位置

C:\\Program Files\\Git C:\\ Program Files \\ Git

Command 命令

$ git clone -b <branch_name> https://<PAT>@<company>.visualstudio.com/... <directory>
Cloning into '<directory>'...
fatal: unable to access 'https://<company>.visualstudio.com/...': error setting certificate verify locations:
  CAfile: /mingw64/ssl/certs/ca-bundle.crt
  CApath: none

I can cat the certificate from Git bash 我可以cat从Git的bash的证书

cat /mingw64/ssl/certs/ca-bundle.crt

git config : git配置

$ git config --list
core.symlinks=false
core.autocrlf=true
core.fscache=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
help.format=html
rebase.autosquash=true
http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
http.sslbackend=openssl
diff.astextplain.textconv=astextplain
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
credential.helper=manager

No ~/.gitconfig file exists 没有~/.gitconfig文件

Trying to use git -c http.sslVerify=false clone ... still fails: (I'm aware this is not secure) 试图使用git -c http.sslVerify=false clone ...仍然失败:(我知道这不安全)

fatal: unable to access 'https://<PAT>@<company>.visualstudio.com/...': error setting certificate verify locations:
  CAfile: /mingw64/ssl/certs/ca-bundle.crt
  CApath: none

Looks like it is still trying to read the certificate?! 看起来它还在尝试阅读证书?!

Commands all run in Git Bash, both with and without administrative privileges, without change in outcome. 命令全部在Git Bash中运行,无论是否有管理权限,都没有改变结果。 The user is an elevated service account. 用户是高级服务帐户。 The same configuration and install works on a test server of the same OS, and install location. 相同的配置和安装适用于相同操作系统的测试服务器,并安装位置。

I once had this very same problem 我曾经遇到过同样的问题

First of all I suggest you to reinstall your GIT client . 首先,我建议您重新安装GIT客户端 This may solve your problem, however it may also cause other problems if you are not really careful in deleting every temp/config file while uninstalling it. 这可能会解决您的问题,但如果您在卸载每个临时/配置文件时不小心删除每个临时/配置文件,它也可能会导致其他问题。

After reinstall my GIT won't work anymore: 重新安装后,我的GIT将不再起作用:

The following comes from this answer: This problem occured after re-installing git for windows. 以下来自这个答案:重新安装git for windows后出现此问题。 I'm using git for windows 64-bit on windows 10. 我在Windows 10上使用git for Windows 64位。

I found out that the installer did not install git anymore in C:/Users/[USER_NAME]/AppData/Local/Programs/Git . 我发现安装程序不再在C:/Users/[USER_NAME]/AppData/Local/Programs/Git Instead it installed it under C:\\Program Files\\Git . 而是将它安装在C:\\Program Files\\Git

Nevertheless the old config file C:\\ProgramData\\Git\\config was not edited by the installer. 然而,安装程序未编辑旧的配置文件C:\\ProgramData\\Git\\config This file still contains the old path so I edited it manually. 此文件仍包含旧路径,因此我手动编辑它。

Eg on my system I used 例如,在我使用的系统上

[http]
     sslCAInfo = C:/Programme/Git/mingw64/ssl/certs/ca-bundle.crt

maybe you will have to use Program Files instead 也许你将不得不使用Program Files

     sslCAInfo = C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt

I got exactly same error when I incorrectly set http proxy to https address. 当我错误地将http代理设置为https地址时,我得到完全相同的错误。 You can check it by running git config --list . 你可以通过运行git config --list来检查它。

I had there entry like: 我有那样的条目:

http.proxy=https://myproxy.com:8080

instead of: 代替:

http.proxy=http://myproxy.com:8080

Encountered this problem on Git-2.16.2-64-bit 在Git-2.16.2-64位上遇到这个问题

downgraded to Git-2.15.0-64-bit 降级为Git-2.15.0-64位

problem gone. 问题消失了。


声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM