繁体   English   中英

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

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

我刚刚为windows安装了git并试图像这样克隆glew的repo

$ 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 -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

第二次尝试

$ 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

然后我在配置文件中检查了http.sslcainfo条目

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

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

系统和全局配置文件没有该条目。 所以我尝试了以下内容,我不知道正在阅读什么文件并尝试取消设置。

$ 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

尝试全球和系统

$ 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

我仍然无法克隆那个github repo。 我可以尝试解决这个问题吗? 我错过了什么?

你是在思考这个问题。 Git需要SSH密钥才能进行传输。 为了实现这一点,您需要在GitHub上拥有一个帐户。 如果您已为其他站点生成了SSH密钥对,则可以重用该密钥对。 您只需登录GitHub.com并将其复制到设置面板中即可。

如果您没有帐户,请创建一个帐户。 如果您还没有生成密钥对,那很简单:

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

然后将密钥复制到GitHub.com中的设置

有关如何以各种方式执行此操作的说明。 我有一个自签名证书,我能够克隆你列出的回购。

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM