簡體   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