Al *_*ath 1 git github digital-certificate
目前,我收到此错误:
$ git clone https://github.com/square/haha.git
Cloning into 'haha'...
fatal: unable to access 'https://github.com/square/haha.git/': SSL certificate problem: self signed certificate in certificate chain
Run Code Online (Sandbox Code Playgroud)
我在Windows 7机器上.我了解到Github的证书是由DigiCert签署的.如果我查看" 受信任的根证书颁发机构">"证书",我会看到颁发给DigiCert的证书:
DigiCert Assured ID Root CA
DigiCert Assured ID Root G2
DigiCert Assured ID Root G3
DigiCert Global Root CA
DigiCert Global Root G2
DigiCert Global Root G3
DigiCert High Assurance EV Root CA
DigiCert Trusted Root G4
Run Code Online (Sandbox Code Playgroud)
GitHub证书是否包含在其中一个中?如果是这样,我该如何使用它?如果不是我如何得到它?
编辑 - 更多信息:
我可以将sslVerify设置为false并且它可以工作,但这当然不安全.
我可以使用git://而不是https://.这也有效,但不是https.
我不能使用SSH,因为此环境没有设置代理.使用ssh:
$ git clone ssh://github.com/square/haha.git
Cloning into 'haha'...
D:/Program Files/Git/usr/bin/bash: -c: line 0: syntax error near unexpected token `<'
D:/Program Files/Git/usr/bin/bash: -c: line 0: `exec corkscrew <proxyhost> <proxyport> ssh.github.com 443 ~/.ssh/proxy_auth'
write: Broken pipe
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Run Code Online (Sandbox Code Playgroud)
想法是下载自签名证书,并在克隆期间引用它:
git -c http.sslCAInfo=/path/to/self/signed/cert clone https://github.com/square/haha.git
Run Code Online (Sandbox Code Playgroud)
例如,您可以使用iwonbigbro/tools/bin/git-remote-install-cert.sh
:
下载所述证书(包括自签名证书)
openssl s_client -connect
Run Code Online (Sandbox Code Playgroud)注册该证书:
git config --global http.sslCAPath "$HOME/.gitcerts"
Run Code Online (Sandbox Code Playgroud)(这$HOME/.gitcerts
是git可以找到所有证书的目录)
该工具,因为它被调用git-remote-install-cert.sh
,由一个git remote-install-cert
(甚至在Windows上)执行.
我建议尽管使用最新的PortableGit-2.5.1-64-bit.7z.exe
,未压缩的任何地方(如in C:\prgs\PortableGit-2.5.1-64-bit
).
然后打电话C:\prgs\PortableGit-2.5.1-64-bit\git-bash.exe
,检查$PATH
并尝试git remote-install-cert
.
例如,在简单的DOS会话中,PATH
包含C:\prgs\bin
:(
它还包括C:\prgs\PortableGit-2.5.1-64-bit\bin
,这意味着我在这里使用git 2.5.0)
C:\prgs\bin\git-remote-install-cert
您复制的文件iwonbigbro/tools/bin/git-remote-install-cert.sh
(因此.sh
最终本地脚本文件名中没有尾随)mkdir -m 0700 -p ${cert%/*}
为mkdir -p ${cert%/*}
(尽管不需要更改行37)进入现有的回购.
或创建一个,并添加远程源URL :(
当然,调整您的环境的路径)
cd C:\Users\vonc\prog
git init b2d
cd b2d
git remote add origin https://github.com/VonC/b2d
Run Code Online (Sandbox Code Playgroud)最后,从该repo调用脚本
C:\Users\vonc\prog\b2d>git remote-install-cert
Requesting certificate from the server...
Certificate installed to: /c/Users/vonc/.gitcerts/github.com.crt
Run Code Online (Sandbox Code Playgroud)那会给你证书:
C:\Users\vonc\prog\b2d>type C:\Users\vonc\.gitcerts\github.com.crt
-----BEGIN CERTIFICATE-----
MIIF4DCCBMigAwIBAgIQDACTENIG2+M3VTWAEY3chzANBgkqhkiG9w0BAQsFADB1
MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
d3cuZGlnaWNlcnQuY29tMTQwMgYDVQQDEytEaWdpQ2VydCBTSEEyIEV4dGVuZGVk
IFZhbGlkYXRpb24gU2VydmVyIENBMB4XDTE0MDQwODAwMDAwMFoXDTE2MDQxMjEy
MDAwMFowgfAxHTAbBgNVBA8MFFByaXZhdGUgT3JnYW5pemF0aW9uMRMwEQYLKwYB
BAGCNzwCAQMTAlVTMRkwFwYLKwYBBAGCNzwCAQITCERlbGF3YXJlMRAwDgYDVQQF
Ewc1MTU3NTUwMRcwFQYDVQQJEw41NDggNHRoIFN0cmVldDEOMAwGA1UEERMFOTQx
....
Run Code Online (Sandbox Code Playgroud)
从那里,你仍然可以在那个仓库中使用该证书获取:
cd C:\Users\vonc\prog\b2d
git config http.sslcapath C:\Users\vonc\.gitcerts
git fetch
git checkout master
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
8085 次 |
最近记录: |