2

GitPython ライブラリを使用して、SSL チェックを無効にしてクローンを作成する方法。次のコード...

import git
x = git.Repo.clone_from('https://xxx', '/home/xxx/lala')

...このエラーが発生します:

Error: fatal: unable to access 'xxx': server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none

「export GIT_SSL_NO_VERIFY=1」については知っていますが、python ライブラリに実装するにはどうすればよいですか?

4

2 に答える 2

4

次の 2 つのメソッドは GitPython 2.0.8 でテストされていますが、少なくとも 1.0.2 以降は機能するはずです (ドキュメントから)。

@Byronが示唆するように:

git.Repo.clone_from(
  'https://example.net/path/to/repo.git',
  'local_destination',
  branch='master', depth=1,
  env={'GIT_SSL_NO_VERIFY': '1'},
)

@クリストファーの提案によると:

git.Repo.clone_from(
  'https://example.net/path/to/repo.git',
  'local_destination',
  branch='master', depth=1,
  config='http.sslVerify=false',
)
于 2016-09-07T06:54:50.833 に答える