我们的组织通过使用域控制器上的组策略来分发内部证书。对于我们的git安装,这意味着我们需要使用 "Windows安全通道 "库来进行HTTPS连接,而不是OpenSSL。
尝试使用VS2019企业版捆绑的Git与schannel连接到远程Git仓库时,出现了错误。
schannel: next InitializeSecurityContext failed: Unknown error (0x80092013) - The revocation function was unable to check revocation because the revocation server was offline
当我使用VS2019用户界面尝试与repo同步时,以及当我通过命令行运行它时,这个错误都会出现。(我使用的可执行文件的路径是 C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\cmd\git.exe
)
然而,如果我运行VS2017捆绑的git可执行文件,我可以成功地与repo同步(可执行路径。C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\cmd\git.exe
). 然而,如果我打开VS2017并尝试使用用户界面,我得到了与上述相同的channel错误!
执行git的独立安装,并使用Windows安全通道进行设置,成功连接到远程仓库。
VS2019 捆绑的 git 无论是使用 IDE UI,还是通过命令行,都无法工作。
VS2017 捆绑的 git 在命令行中可以工作,但不能通过 IDE UI 工作。
我的全局.gitconfig是这样的。
[user]
name = xxx
email = [email protected]
[http]
sslBackend = schannel
VS2019的.gitconfig是这样的。
[core]
symlinks = false
autocrlf = true
[color]
diff = auto
status = auto
branch = auto
interactive = true
[pack]
packSizeLimit = 2g
[help]
format = html
[diff "astextplain"]
textconv = astextplain
[rebase]
autosquash = true
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
[include]
; include Git for Windows' system config in order
; to inherit settings like `core.autocrlf`
path = C:/Program Files (x86)/Git/etc/gitconfig
path = C:/Program Files/Git/etc/gitconfig
VS2017的.gitconfig看起来是这样的(和VS2019完全一样)。
[core]
symlinks = false
autocrlf = true
[color]
diff = auto
status = auto
branch = auto
interactive = true
[pack]
packSizeLimit = 2g
[help]
format = html
[diff "astextplain"]
textconv = astextplain
[rebase]
autosquash = true
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
[include]
; include Git for Windows' system config in order
; to inherit settings like `core.autocrlf`
path = C:/Program Files (x86)/Git/etc/gitconfig
path = C:/Program Files/Git/etc/gitconfig
你可以尝试以下步骤。
删除文件夹 (你可以备份这个文件夹,以防你需要恢复它)。C:\Program Files (x86)\Microsoft Visual Studio\2019\xxx\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git
确保系统中没有安装任何版本的Git。将它们卸载到 Control Panel / Uninstall a program
一旦你有了Git.Net,你就会发现,Git.Net是一个很好的工具。
下载 最新版本 并安装它。
在Git shell中执行此命令来禁用撤销检查。
$ git config --global http.schannelCheckRevoke false
注意:
从 这个环节:
我们不建议在正常使用 Git 时设置这个配置值。 这是为了在网络管理员限制Git在Windows上正常使用Schannel API的情况下,提供一个 "逃生通道"。