【问题标题】:how to disable ssl verification on pygit2如何在pygit2上禁用ssl验证
【发布时间】:2016-04-26 02:55:50
【问题描述】:

我正在使用 pygit2 以编程方式从拥有自签名证书的内部服务器克隆存储库。 pygit2在证书上报错,如何关闭验证?

【问题讨论】:

  • 请您发布尝试执行此操作的代码行,这样更容易回答

标签: python git libgit2 pygit2


【解决方案1】:

检查是因为pygit2/remote.py#L170-L175而完成的

def _fill_fetch_options(self, fetch_opts):
    fetch_opts.callbacks.certificate_check = self._certificate_cb

作为in this question,您可以为git_fetch_options struct 覆盖callback function with your own(不会执行任何操作)。

git_fetch_options options = GIT_FETCH_OPTIONS_VERSION;
options.git_remote_callbacks.certificate_check = my_own_cred_acquire_cb;

这种方法在OP's own issue on pygit2中得到了回应和确认:

您不能告诉 pygit2/libgit2 忽略所有内容,但您可以提供自己的证书验证函数作为回调。
如果您将certificate_check 设置为您编写的某个函数,则可以忽略已知错误主机的证书。

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2016-07-27
  • 2022-08-04
  • 1970-01-01
  • 2020-07-12
  • 2018-08-07
  • 2022-01-23
  • 1970-01-01
相关资源
最近更新 更多