简体   繁体   English

如何解决SSL证书:从github克隆repo时自签名证书?

[英]How to solve SSL certificate: self signed certificate when cloning repo from github?

I just installed git for windows and tried to clone glew's repo like this 我刚刚为windows安装了git并试图像这样克隆glew的repo

$ git clone https://github.com/nigels-com/glew.git

But I got the following error 但是我得到了以下错误

Cloning into 'glew'...
fatal: unable to access 'https://github.com/nigels-com/glew.git/': SSL certificate problem: self signed certificate

I've seen people running into this problem and some possible workarounds. 我见过人们遇到这个问题和一些可能的解决方法。

First try 第一次尝试

$ git -c http.sslVerify=false clone https://github.com/nigels-com/glew.git
Cloning into 'glew'...
fatal: unable to access 'https://github.com/nigels-com/glew.git/': Empty reply from server

Second try 第二次尝试

$ git config --global http.sslVerify false
$ git clone https://github.com/nigels-com/glew.git
Cloning into 'glew'...
fatal: unable to access 'https://github.com/nigels-com/glew.git/': Empty reply from server

Then I checked for http.sslcainfo entry in the config files 然后我在配置文件中检查了http.sslcainfo条目

$ git config --system --list
credential.helper=manager

$ git config --global --list
https.proxy=<proxy-address>
http.sslverify=false

System and global config files does not have that entry. 系统和全局配置文件没有该条目。 So I tried the following which I don't know what file is reading and try to unset it. 所以我尝试了以下内容,我不知道正在阅读什么文件并尝试取消设置。

$ 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
http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
diff.astextplain.textconv=astextplain
rebase.autosquash=true
credential.helper=manager
http.sslverify=false

$ git config --unset http.sslcainfo
fatal: not in a git directory

Tried with global and system 尝试全球和系统

$ git config --global --unset http.sslcainfo
$ git clone https://github.com/nigels-com/glew.git
Cloning into 'glew'...
fatal: unable to access 'https://github.com/nigels-com/glew.git/': SSL certificate problem: self signed certificate

$ git config --system --unset http.sslcainfo
error: could not lock config file C:\Program Files\Git\mingw64/etc/gitconfig: Permission denied
error: could not lock config file C:\Program Files\Git\mingw64/etc/gitconfig: Invalid argument

I still cannot clone that github repo. 我仍然无法克隆那个github repo。 Any other idea I can try to fix this problem? 我可以尝试解决这个问题吗? What am I missing? 我错过了什么?

You're overthinking this. 你是在思考这个问题。 Git requires the SSH key to do the transfer. Git需要SSH密钥才能进行传输。 In order for this to work, you need an account on GitHub. 为了实现这一点,您需要在GitHub上拥有一个帐户。 If you have already generated an SSH key pair for other sites, you can reuse that one. 如果您已为其他站点生成了SSH密钥对,则可以重用该密钥对。 All you need to do is log into GitHub.com and copy it there in your settings panel. 您只需登录GitHub.com并将其复制到设置面板中即可。

If you don't have an account, make one. 如果您没有帐户,请创建一个帐户。 If you haven't generated a key pair, that's simple: 如果您还没有生成密钥对,那很简单:

ssh-keygen -t rsa -C "youremail@somewhere.com"

Then copy the key to your settings in GitHub.com 然后将密钥复制到GitHub.com中的设置

There are instructions all over the place on how to do this in various ways. 有关如何以各种方式执行此操作的说明。 I have a self-signed cert and I was able to clone the repo you listed. 我有一个自签名证书,我能够克隆你列出的回购。

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

相关问题 如何解决 [curl: (60) SSL 证书问题:证书链中的自签名证书] - How to solve [curl: (60) SSL certificate problem: self signed certificate in certificate chain] GitHub证书链中的自签名证书 - Self signed certificate in certificate chain with GitHub 克隆 git repo 时出现 SSL 证书错误 - SSL certificate error while cloning a git repo SSL 证书问题:证书链中的自签名证书 - SSL certificate problem: self signed certificate in certificate chain Git - “SSL证书问题:证书链中的自签名证书” - Git - “SSL certificate issue: self signed certificate in certificate chain” 使用自签名证书通过https从egit连接到github企业 - connect to github enterprise from egit over https with a self signed certificate 如何让Git接受我自己签署的SSL证书? - How to get Git accept my self signed SSL certificate? 无法访问“https://github.com/user name/projectName.git/”:SSL 证书问题:证书链中的自签名证书 - unable to access 'https://github.com/user name/projectName.git/': SSL certificate problem: self signed certificate in certificate chain 在本地上克隆VSTS存储库时,面临SSL证书问题 - While cloning a VSTS repo on local, facing SSL certificate issue 具有自签名证书的私有git repo作为Concourse资源 - Private git repo with self-signed certificate as Concourse resource
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM