git Github:克隆我的私有存储库时出错
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3778042/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Github: error cloning my private repository
提问by Mot
I'm trying to clone my GitHub project using the https-URL, but it fails with an error:
我正在尝试使用 https-URL 克隆我的 GitHub 项目,但失败并出现错误:
$ git clone https://[email protected]/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://[email protected]/foo/foo-private.git/info/refs
fatal: HTTP request failed
What am I doing wrong?
我究竟做错了什么?
回答by mstrap
I have seen this on Windows, with msysgit 1.7.2.3. You have to fix the path to bin/curl-ca-bundle.crt. I had to specify the absolute path, using back-slashes:
我在 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"
or — not really recommended — you may choose to switch off SSL checks completely by executing:
或者——不是真的推荐——你可以选择通过执行来完全关闭 SSL 检查:
git config --system http.sslverify false
For both cases, this will result in changes to [git-install-dir]/etc/gitconfig file, which may be edited directly, too.
对于这两种情况,这都会导致 [git-install-dir]/etc/gitconfig 文件的更改,该文件也可以直接编辑。
(Original solutions found at http://github.com/blog/642-smart-http-support)
回答by rogertoday
I solved the problem installing the Git from: https://git-for-windows.github.io/Locate the cert file path:
我解决了安装 Git 的问题:https: //git-for-windows.github.io/找到证书文件路径:
D:\Program Files\Git\mingw64\ssl\certs\ca-bundle.crt
D:\Program Files\Git\mingw64\ssl\certs\ca-bundle.crt
Configure the Git path:
配置 Git 路径:
git config --system http.sslcainfo "D:\Program Files\Git\mingw64\ssl\certs\ca-bundle.crt"
git config --system http.sslcainfo "D:\Program Files\Git\mingw64\ssl\certs\ca-bundle.crt"
Try again
再试一次
回答by CoolOppo
If you use MSYS2...
如果您使用 MSYS2...
Just install the certificate packages with the following commands:
只需使用以下命令安装证书包:
32 bits
32位
pacman -S mingw-w64-i686-ca-certificates ca-certificates
64 bits
64位
pacman -S mingw-w64-x86_64-ca-certificates ca-certificates
回答by Jiangwei Yu
If you were using Cygwin, you might install the ca-certificatespackage with apt-cyg:
如果您使用的是 Cygwin,则可以使用apt-cyg安装ca-certificates包 :
wget rawgit.com/transcode-open/apt-cyg/master/apt-cyg
install apt-cyg /usr/local/bin
apt-cyg install ca-certificates
回答by Abu Bakr
git config --global http.sslverify "false"
Will solve the problem. After that a Pop-up window appears to enter your username and password
会解决问题。之后会出现一个弹出窗口,输入您的用户名和密码
回答by Louis BAYLE
SOLVED: I got this error when I installed an update to the Git windows installer. What happened is that I did not install it with administrator rights, so Git was installed in "C:\Users\my_name\AppData\Local\Programs" instead of "C:\program Files". re-installing Git as administrator allowed to put it in C:\program Files and everything went fine again !
已解决:当我安装 Git Windows 安装程序的更新时出现此错误。发生的事情是我没有使用管理员权限安装它,所以 Git 安装在“C:\Users\my_name\AppData\Local\Programs”而不是“C:\program Files”。以管理员身份重新安装 Git 允许将它放在 C:\program Files 中,一切又正常了!
回答by Duy Nguyen
This worked for me (I'm using Manjaro linux). I run the cmd to view ca-certificates:
这对我有用(我使用的是 Manjaro linux)。我运行 cmd 来查看 ca 证书:
$ curl-config --ca
**/etc/ssl/certs/ca-certificates.crt**
But actually i found the certificates at the path:
但实际上我在路径上找到了证书:
**/etc/ca-certificates/extracted/ca-bundle.trust.crt**
Then add the config into ~/.gitconfig (if not existing, create it):
然后将配置添加到 ~/.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>
It works!
有用!
.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(-)
回答by KannarKK
git config --system http.sslcainfo /bin/curl-ca-bundle.crt
git config --system http.sslcainfo /bin/curl-ca-bundle.crt
This works. You don't have to give full path.
这有效。您不必提供完整路径。
回答by arulraj.net
I faced this while git pull. For mine edited the global git config file that fixed problem.
我在 git pull 时遇到了这个问题。对于我的编辑了修复问题的全局 git 配置文件。
Goto your home folder and open .gitconfig file. Usually C:\Users\.gitconfig
转到您的主文件夹并打开 .gitconfig 文件。通常是 C:\Users\.gitconfig
If the file is not there create it
如果文件不存在,则创建它
[http]
sslcainfo = E:\systools\git-1.8.5.2\bin\curl-ca-bundle.crt
[http]
sslcainfo = E:\systools\git-1.8.5.2\bin\curl-ca-bundle.crt
There you have to given your own git installation path. I have used portable version of git here.
在那里你必须给出你自己的 git 安装路径。我在这里使用了便携式版本的 git。
Then git clone / pull it will work.
然后 git clone / pull 就可以了。
回答by Paul D
If you are using the Git command shell that installs with the GitHub for Windows app then this and various other problems can show after an update. Just start the Git Hub windows app and shut it down again. The shell will then work OK again. The problem is that the update does not complete until the windows application is run. Just using the shell on its does not trigger the update to complete.
如果您使用的是随 GitHub for Windows 应用程序一起安装的 Git 命令外壳,那么在更新后可能会出现此问题和其他各种问题。只需启动 Git Hub windows 应用程序并再次关闭它。然后外壳将再次正常工作。问题是在 Windows 应用程序运行之前更新不会完成。仅在其上使用外壳不会触发更新完成。