git - 从终端/命令提示符创建新存储库的问题
问题描述
当我尝试通过 Git API 调用从终端提示创建存储库时。由于无法从终端提示符创建新存储库但我能够克隆并推送我的存储库文件。
Command Prompt
C:\Users\user>curl -u 'UniqueUserName' https://api.github.com/user/repos -d '{"name":"MyNewRepo"}'
Enter host password for user ''UniqueUserName'':
curl: (35) schannel: next InitializeSecurityContext failed: Unknown error (0x80092013) - The revocation function was unable to check revocation because the revocation server was offline.
C:\Users\user>
电源外壳
PS C:\Users\user> curl -u 'UniqueUserName' https://api.github.com/user/repos -d '{"name":"MyNewRepo"}'
Invoke-WebRequest : Parameter cannot be processed because the parameter name 'u' is ambiguous. Possible matches
include: -UseBasicParsing -Uri -UseDefaultCredentials -UserAgent.
At line:1 char:6
+ curl -u 'UniqueUserName' https://api.github.com/user/repos -d '{"name ...
+ ~~
+ CategoryInfo : InvalidArgument: (:) [Invoke-WebRequest], ParameterBindingException
+ FullyQualifiedErrorId : AmbiguousParameter,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
PS C:\Users\user>
从Git Bash 终端命令挂起。
为什么我从命令提示符处收到以下错误消息
curl: (35) schannel: next InitializeSecurityContext failed: Unknown error (0x80092013) - 由于吊销服务器脱机,吊销功能无法检查吊销。
解决方案
您使用的 curl 版本使用的是 Windows TLS 库 Schannel。您收到的错误消息意味着 Schannel 尝试检查服务器的证书是否被吊销(某些 TLS 库会在连接时自动执行),并且提供吊销状态的服务器(通过 CRL 或 OCSP)不可用。
如果您在公司网络上或在某些情况下存在 TLS 代理(包括某些防病毒程序),则代理可能会提供包含错误信息的证书,或者可能无法提供有效的 OCSP 或 CRL URL。在这种情况下,您应该尝试完全卸载防病毒程序并重试,从没有 TLS MITM 设备的其他网络重试,或者联系您的本地网络管理员并向他们解释情况。
如果这些都不适用于您,那么相关的 OCSP 服务器很可能刚刚关闭,当事情再次恢复时您将能够连接。一些服务器通过使用 OCSP 装订为这种情况提供了预包含的缓存响应,但 api.github.com 没有。