简体   繁体   中英

GnuTLS: Failed to acquire random data with GIT_SSH_COMMAND

I have a script that tries to clone Git repositories in the background, without the user being able to provide credentials. Thus, it sets GIT_SSH_COMMAND to enable OpenSSH batch mode. Example script that reproduces the problem:

import subprocess, sys
popen = subprocess.Popen(
  ['git', 'clone', 'https://github.com/NiklasRosenstein/flux.git'],
  env={'GIT_SSH_COMMAND': 'ssh -oBatchMode=yes'},
)
popen.wait()
sys.exit(popen.returncode)

Without setting GIT_SSH_COMMAND , the command runs fine. But with it, I get

C:\Users\niklas\Desktop
λ test
Cloning into 'flux'...
Error in GnuTLS initialization: Failed to acquire random data.
fatal: unable to access 'https://github.com/NiklasRosenstein/flux.git/': Couldn't resolve host 'github.com'

What's going wrong here? Using Git-for-Windows 2.6.1.windows.1

Take a look at your repository URL. You want to be using the ssh or git protocol, not http/https.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM