[英]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.