我正在使用pygit2以编程方式从内部服务器克隆一个存储库,该服务器持有一个自签名证书。pygit2在证书上出现错误,如何关闭验证?
发布于 2016-04-26 14:48:05
该检查是由于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设置为您编写的某些函数,则可以忽略已知错误的主机的证书。
https://stackoverflow.com/questions/36854484
复制相似问题