我们的TFS服务器最初使用自签名证书设置为使用https,首先我们仅为TFS设置Windows代理服务器以运行CI,所有这些都运行良好。
最近,我们的团队计划尝试将Linux代理添加到TFS中以在Linux代理服务器上运行CI,但是失败了,经过一些研究,我们发现它是由自签名证书引起的,并计划替换它。但是,更换证书后,我们将无法在VS中克隆存储库,也无法在代理Windows机器上运行CI。
我们替换证书的步骤是:
config.cmd --gituseschannel
配置代理,代理版本为2.134.0,身份验证类型为PAT或Negotiate。2019-02-12T06:42:42.8065249Z ##[section]Starting: Get Sources
2019-02-12T06:42:42.8723145Z Syncing repository: Wpf_Test123 (TfsGit)
2019-02-12T06:42:42.8889419Z Prepending Path environment variable with directory containing 'git.exe'.
2019-02-12T06:42:42.9054694Z ##[command]git version
2019-02-12T06:42:43.0987464Z git version 2.14.3.windows.1
2019-02-12T06:42:43.1221489Z ##[command]git init "C:\vsts-agent-win-x64-2.134.0_work\1\s"
2019-02-12T06:42:43.3212108Z Initialized empty Git repository in C:/vsts-agent-win-x64-2.134.0/_work/1/s/.git/
2019-02-12T06:42:43.3335023Z ##[command]git remote add origin https://***/DefaultCollection/_git/Wpf_Test123
2019-02-12T06:42:43.4327285Z ##[command]git config gc.auto 0
2019-02-12T06:42:43.5076750Z ##[command]git config --get-all
http.https://devtfs.cmit.local/DefaultCollection/_git/Wpf_Test123.extraheader
2019-02-12T06:42:43.5797842Z ##[command]git config --get-all http.proxy
2019-02-12T06:42:43.6661206Z ##[command]git -c http.extraheader="AUTHORIZATION: bearer ***" -c http.sslbackend="schannel" fetch --tags --prune --progress --no-recurse-submodules origin
2019-02-12T06:42:43.9878987Z fatal: unable to access 'https://***/DefaultCollection/_git/Wpf_Test123/': schannel: next InitializeSecurityContext failed: Unknown error (0x80092012) - �������������֤���Ƿ������
2019-02-12T06:42:44.0309325Z ##[error]Git fetch failed with exit code: 128
2019-02-12T06:42:44.0356930Z ##[section]Finishing: Get Sources
在Visual Studio中,尝试克隆仓库,出现类似错误:
Error encountered while cloning the remote repository: Git failed with a fatal error.
unable to access 'https://***/DefaultCollection/Banyan/_git/ControlCenterHome/': schannel: CertGetCertificateChain trust error CERT_TRUST_IS_PARTIAL_CHAIN
我们在Github上发现了一个使用github桌面的类似问题: https://github.com/desktop/desktop/issues/4821
在此线程https://github.com/desktop/desktop/issues/4817中,我们尝试删除
[http]
sslCAinfo = /ssl/certs/ca-bundle.crt
在配置文件中,但问题仍然存在。
运行git config -l --show-origin
的结果是
file:"C:\ProgramData/Git/config" core.symlinks=false
file:"C:\ProgramData/Git/config" core.autocrlf=true
file:"C:\ProgramData/Git/config" core.fscache=true
file:"C:\ProgramData/Git/config" color.diff=auto
file:"C:\ProgramData/Git/config" color.status=auto
file:"C:\ProgramData/Git/config" color.branch=auto
file:"C:\ProgramData/Git/config" color.interactive=true
file:"C:\ProgramData/Git/config" help.format=html
file:"C:\ProgramData/Git/config" rebase.autosquash=true
file:"C:\vsts-agent-win-x64-2.134.0\externals\git\mingw64/etc/gitconfig" core.symlinks=false
file:"C:\vsts-agent-win-x64-2.134.0\externals\git\mingw64/etc/gitconfig" core.autocrlf=true
file:"C:\vsts-agent-win-x64-2.134.0\externals\git\mingw64/etc/gitconfig" color.diff=auto
file:"C:\vsts-agent-win-x64-2.134.0\externals\git\mingw64/etc/gitconfig" color.status=auto
file:"C:\vsts-agent-win-x64-2.134.0\externals\git\mingw64/etc/gitconfig" color.branch=auto
file:"C:\vsts-agent-win-x64-2.134.0\externals\git\mingw64/etc/gitconfig" color.interactive=true
file:"C:\vsts-agent-win-x64-2.134.0\externals\git\mingw64/etc/gitconfig" pack.packsizelimit=2g
file:"C:\vsts-agent-win-x64-2.134.0\externals\git\mingw64/etc/gitconfig" help.format=html
file:"C:\vsts-agent-win-x64-2.134.0\externals\git\mingw64/etc/gitconfig" diff.astextplain.textconv=astextplain
file:"C:\vsts-agent-win-x64-2.134.0\externals\git\mingw64/etc/gitconfig" rebase.autosquash=true
file:C:/Users/Administrator/.gitconfig http.sslbackend=schannel
我们的TFS环境是:
问题是:
我们可以在gitconfig中添加sslVerify = false
作为解决方法,但这不符合要求。我们需要ssl证书才能与TFS一起使用。
试图解决VS中提到的错误:Error encountered while cloning the remote repository: Git failed with a fatal error. unable to access 'https://***/DefaultCollection/Banyan/_git/ControlCenterHome/': schannel: CertGetCertificateChain trust error CERT_TRUST_IS_PARTIAL_CHAIN
更新
我们做到了,这里是简要信息:
openssl genrsa -out ca-dev.key 2048
openssl req -new -out ca.csr -key ca.key -keyform PEM / 公用名与服务器证书不同 /
openssl x509 -req -in ca.csr -out ca.crt -signkey ca.key -CAcreateserial -days 3650
openssl pkcs12 -export -clcerts -in ca.crt -inkey ca.key -out ca-dev.p12
答案 0 :(得分:0)
CERT_TRUST_IS_PARTIAL_CHAIN
表示您错过了链的根或某些中间证书。
在步骤3中,您说
在TFS服务器上,安装根CA证书和服务器证书。
这是正确的,但是您需要在所有客户端上安装根CA。