GnuTLS: Failed to acquire random data with GIT_SSH_COMMAND

1.3k Views Asked by At

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

1

There are 1 best solutions below

0
On

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