Github:错误克隆我的私人存储库

时间:2010-09-23 11:51:41

标签: git github

我正在尝试使用https-URL克隆我的GitHub项目,但它失败并显示错误:

$ git clone https://foo@github.com/foo/foo-private.git
Cloning into foo-private...
Password:
error: error setting certificate verify locations:
  CAfile: /bin/curl-ca-bundle.crt
  CApath: none
 while accessing https://foo@github.com/foo/foo-private.git/info/refs

fatal: HTTP request failed

我做错了什么?

26 个答案:

答案 0 :(得分:278)

我在Windows上看过这个,有msysgit 1.7.2.3。您必须修复 bin / curl-ca-bundle.crt 的路径。我必须使用反斜杠指定绝对路径:

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

或 - 不是真的推荐 - 您可以通过执行以下命令选择完全关闭SSL检查:

git config --system http.sslverify false

对于这两种情况,这将导致对[git-install-dir] / etc / gitconfig文件的更改,也可以直接编辑。

(在http://github.com/blog/642-smart-http-support找到的原始解决方案)

答案 1 :(得分:72)

我解决了从https://git-for-windows.github.io/安装Git的问题 找到证书文件路径:

  

D:\ Program Files \ Git \ mingw64 \ ssl \ certs \ ca-bundle.crt

配置Git路径:

  

git config --system http.sslcainfo" D:\ Program   文件\ GIT中\ mingw64 \ SSL \证书\ CA-bundle.crt"

再试一次

答案 2 :(得分:20)

如果您使用MSYS2 ...

只需使用以下命令安装证书包:

32位

pacman -S mingw-w64-i686-ca-certificates ca-certificates

64位

pacman -S mingw-w64-x86_64-ca-certificates ca-certificates

答案 3 :(得分:12)

如果您使用的是Cygwin,则可以安装 ca-certificates 易于-CYG

wget rawgit.com/transcode-open/apt-cyg/master/apt-cyg
install apt-cyg /usr/local/bin
apt-cyg install ca-certificates

How do I install a cygwin package from the command line?

答案 4 :(得分:7)

解决: 当我在Git Windows安装程序上安装更新时出现此错误。发生的事情是我没有使用管理员权限安装它,因此Git安装在“C:\ Users \ my_name \ AppData \ Local \ Programs”而不是“C:\ program Files”中。以管理员身份重新安装Git允许将它放在C:\ program Files中,一切都恢复正常了!

答案 5 :(得分:6)

git config --global http.sslverify "false" 

将解决问题。 之后会出现一个弹出窗口,输入您的用户名和密码

答案 6 :(得分:5)

这对我有用(我正在使用Manjaro linux)。我运行cmd来查看ca-certificates:

$ curl-config --ca
**/etc/ssl/certs/ca-certificates.crt**

但实际上我在路径上找到了证书:

**/etc/ca-certificates/extracted/ca-bundle.trust.crt**

然后将配置添加到〜/ .gitconfig(如果不存在,创建它):

**vim ~/.gitconfig**
[http]
    sslVerify = true
    sslCAinfo = /etc/ca-certificates/extracted/ca-bundle.trust.crt

[user]
    email = <email of github account>
    name = <username of github account>

有效!

.rbenv]$ git pull

remote: Counting objects: 70, done.
remote: Compressing objects: 100% (47/47), done.
remote: Total 70 (delta 39), reused 12 (delta 12), pack-reused 6
Unpacking objects: 100% (70/70), done.
From https://github.com/sstephenson/rbenv
   c43928a..efb187f  master     -> origin/master
 + 37ec781...7e57b52 user-gems  -> origin/user-gems  (forced update)
Updating c43928a..efb187f
Fast-forward
 libexec/rbenv-init         |  4 ++--
 libexec/rbenv-version-file |  1 +
 test/init.bats             |  2 +-
 test/test_helper.bash      | 25 +++++++++++++++----------
 4 files changed, 19 insertions(+), 13 deletions(-)

答案 7 :(得分:3)

git config --system http.sslcainfo /bin/curl-ca-bundle.crt  

这很有效。你不必给出完整的路径。

答案 8 :(得分:3)

我面对这个,而git拉。因为我编辑了修复问题的全局git配置文件。

转到您的主文件夹并打开.gitconfig文件。通常是C:\ Users \ .gitconfig

如果文件不存在则创建

  

[HTTP]
    sslcainfo = E:\ systools \ git-1.8.5.2 \ bin \ curl-ca-bundle.crt

你必须给出自己的git安装路径。我在这里使用了便携版的git。

然后git clone / pull它会起作用。

答案 9 :(得分:2)

我在Github for Windows上看过这个。

我建议卸载Github for Windows并重新安装。

在此之前,我尝试了几种方法但没有成功,但这个解决方案对我有用!

答案 10 :(得分:2)

如果您使用的是与GitHub for Windows应用程序一起安装的Git命令shell,那么在更新后可能会显示此问题和其他各种问题。只需启动Git Hub Windows应用程序并再次关闭它。然后shell将再次正常工作。问题是在运行Windows应用程序之前,更新无法完成。只是在其上使用shell不会触发更新完成。

答案 11 :(得分:1)

另外,如果尝试使用git的用户与安装它的用户不同,则可能会在Windows中发生此问题。该错误可能表示git无法访问证书文件。以管理员身份安装git并使用@ rogertoday的答案解决了我的问题。

答案 12 :(得分:1)

我找到了adding/updating the CA certificates on RHEL/CentOS 6的一个很好的解决方案,这是导致问题的根本原因。

由于它们已成为过时的发行版,因此在执行命令sudo yum update之前,该系统中的cacert权限尚未更新。

在GIT_CURL_VERBOSE模式显示cacert路径问题之前,我们没有意识到这个问题。

答案 13 :(得分:1)

对于win10,我有两个版本.gitconfig

  • 第一个在C:\Program Files\Git\etc
  • 第二个在C:\Users\<user>

命令

git config --system http.sslcainfo "C:\Program Files\Git\mingw64\ssl\certs\ca-bundle.crt"

确实对C:\Program Files\Git\etc进行了更改,但是git以某种方式在C:\Users\<user>中使用config

因此,使用记事本,我更改了第二个.gitconfig,git最终进行了正确的配置并开始工作。

答案 14 :(得分:1)

在使用msysgit的Windows上出现此错误,原因是我添加了公司代理证书。

如果您编辑curl-ca-bundle.crt,则必须确定您的lineendings。如果是curl-ca-bundle,你必须使用Linux-Style lineendings。

> git ls-remote --tags --heads https://github.com/oblador/angular-scroll.git
fatal: unable to access 'https://github.com/oblador/angular-scroll.git/': error setting certificate verify locations:
  CAfile: C:\Program Files (x86)\Git\bin\curl-ca-bundle.crt
  CApath: none

您可以使用notepad ++将lineendings转换为Linux(linefeed)。

答案 15 :(得分:0)

我在更新到 Visual Studio 2019 16.10.2(从 16.10.0 开始)后遇到了这个错误,而之前 Git 可以正常工作。

我没有单独安装 Git。 (或者,换句话说,我只使用 Git 作为 Visual Studio 的一部分。)

我通过在 "ca-bundle.crt" 找到文件 "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\mingw32\ssl\certs\ca-bundle.crt",然后将其复制到它指示无法在 "C:\Program Files\Git\mingw64\ssl\certs\ca-bundle.crt" 处找到它的文件夹解决了这个问题。

请注意,我必须创建“\mingw64\ssl\certs”目录,因为它们以前不存在。

在那里复制文件后,Git 无需重新启动 Visual Studio 即可立即再次同步。

答案 16 :(得分:0)

64位Windows 中对我适用的解决方案如下

  

git config --system http.sslverify false

答案 17 :(得分:0)

对于使用 Windows 10 的 MinGit 用户

您必须对 @mstrap's answer 稍作调整。

git config --system http.sslcainfo "<PATH-TO-MINGIT>\mingw64\ssl\certs\ca-bundle.crt"

答案 18 :(得分:0)

我已通过重新安装Windows Server 2016并在“选择HTTPS传输后端”安装步骤中选择“本地Windows安全通道库”来解决此问题。

答案 19 :(得分:0)

如果其他人在Windows版Git中面临此问题,并且即使重新安装后系统上也没有curl-ca-bundle.crt,这是我遵循的过程:

  1. 在此处下载curl的最新版本:http://api.jquery.com/attr/
  2. 在命令行中提取并导航到curl-**.**.*/lib
  3. 运行./mk-ca-bundle.prl
  4. ca-bundle.crt复制到您的git路径并按照其他答案中的列出更新配置

curl download mirror大声疾呼,以帮助我完成安装。

答案 20 :(得分:0)

对我来说解决问题的是当我在我的Windows 10盒子上,我尝试卸载git和resintalling,使用Windows Cmd作为默认值而不是Git Bash

打开CMD并运行以下

//Once installed try to resintall the bin folder 
git config --system http.sslcainfo \bin/curl-ca-bundle.crt

//disable ssl verification
git config --global http.sslverify "false"

//Then try to clone repo again
git clone git@github.com:account/someproject.git

答案 21 :(得分:0)

在Linux上,我遇到了这个错误并通过运行sudo update-ca-certificates修复了它。

答案 22 :(得分:-1)

在Windows版git上,您也可以重新安装并选择 Windows本机证书验证方法(默认为OpenSSL)。这将跳过OpenSSL验证,而是使用Windows本机验证,该验证不需要维护单独的工具(OpenSSL)和证书。

对我来说非常适合:)

答案 23 :(得分:-1)

我在硬盘上移动git后收到此错误。删除并重新安装在新位置固定的东西

答案 24 :(得分:-1)

我能够使用以下命令解决此问题。

git config --system http.sslverify false

答案 25 :(得分:-2)

以下命令

git clone git://github.com/username/projectname.git

满足了我的需求,但我认为你想要的只是只读访问权限,对吗?

相关问题