无法拉/推git存储库

Arv*_*ind 45 git github-for-windows

$ git pull origin master
fatal: unable to access 'https://xxxxxxxxxxxxxxx': 
      error setting certificate verify locations:
CAfile: C:/Users/abc/AppData/Local/Programs/Git/usr/bin/curl-ca-bundle.crt
CApath: none
Run Code Online (Sandbox Code Playgroud)

当我拉或推我的代码时,我收到此错误.

请指导我解决这个问题.

Cod*_*ard 47

使用时,https您需要提供密码或使用证书.在您的情况下,证书看起来不是有效证书.

尝试通过告诉git在哪里找到证书来修复它:

// Add the certificate to your configuration file
git config --system http.sslcainfo "C:\Program Files (x86)\git\bin\curl-ca-bundle.crt"
Run Code Online (Sandbox Code Playgroud)

或者,您可以禁用SSL检查:

// or switch off SSL checks completely by executing:
git config --system http.sslverify false
Run Code Online (Sandbox Code Playgroud)

在您的配置中设置此选项仅为给定的URL而不是所有请求禁用它

[http "https://weak.example.com"]
    sslVerify = false
Run Code Online (Sandbox Code Playgroud)

http.sslVerify

获取或推送HTTPS时是否验证SSL证书.


http.sslCAInfo

包含证书的文件,用于在获取或推送HTTPS时验证对等方

  • 不建议禁用`sslVerify` (12认同)
  • 我用它来git版本2.12.2.windows.1:`git config --system http.sslcainfo"c:\ Program Files\Git\mingw64\ssl\certs\ca-bundle.crt"` (6认同)
  • 将是非常聪明的解决方案^^,我不知道,谢谢@codeWizard (2认同)
  • 对于访问此帖子的任何人,如果您可以为git提供正确的证书,则无需禁用https检查.只需运行第一个命令指向ca-bundle.crt文件就足以解决问题.如果没有,则尝试禁用SSL检查.:) (2认同)

Ren*_*ink 25

我曾经遇到过同样的问题.重新安装git for windows后出现问题.我在Windows 10上使用git for Windows 64位.

我发现安装程序不再安装git了C:/Users/[USER_NAME]/AppData/Local/Programs/Git.而是安装它 C:\Program Files\Git.

然而C:\ProgramData\Git\config,安装程序未编辑旧的配置文件.此文件仍包含旧路径,因此我手动编辑它.

例如,在我使用的系统上

[http]
     sslCAInfo = C:/Programme/Git/mingw64/ssl/certs/ca-bundle.crt
Run Code Online (Sandbox Code Playgroud)

也许你将不得不使用Program Files替代

     sslCAInfo = C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
Run Code Online (Sandbox Code Playgroud)

编辑

就像DS在评论中说的那样

需要以管理员身份编辑C:\ ProgramData\Git\config .

例如,右键单击记事本并选择"以管理员身份运行",然后打开文件.

  • 究竟是怎么回事我.还有一点需要注意:C:\ ProgramData\Git\config需要以管理员身份进行编辑. (2认同)

小智 24

我也在Windows中遇到这个问题并使用gitbash运行git.我刚刚重新安装了gitbash,而gitbash自动管理了git证书及其所需的路径.

  • 我刚刚重新安装了gitbash,现在工作正常。 (2认同)
  • 你如何单独安装gitbash? (2认同)

小智 12

在git-bash的2.x版中,.crt的路径已更改为../Git/mingw64/ssl/certs/ca-bundle.crt.我不得不在git-bash中手动更新

 git config --global http.sslcainfo "/path/to/Git/mingw64/ssl/certs/ca-bundle.crt"
Run Code Online (Sandbox Code Playgroud)


Pra*_*una 5

试试这个

git config --system http.sslcainfo "C:\Program Files (x86)\git\bin\curl-ca-bundle.crt"
Run Code Online (Sandbox Code Playgroud)

要么

运行此命令关闭SSL

git config --system http.sslverify false
Run Code Online (Sandbox Code Playgroud)

  • 不建议禁用`sslVerify` (4认同)

Abu*_*akr 5

 git config --global http.sslverify "false" 
Run Code Online (Sandbox Code Playgroud)
  • 在弹出窗口中输入您的用户名和密码后,将解决问题,确保有效。


Rau*_*oor 5

当 git 客户端无法找到 ssl 的可信 CA 时,可能会出现此问题。如果您使用的是 Windows,请尝试从https://gitforwindows.org/重新安装它。

在安装过程中,选择“使用本机 Windows 安全通道库”选项。该选项将允许您使用公司的内部根 CA 证书而不是默认的 ca-bundle.crt

在此输入图像描述