never wait for SSH prompts when running git commands

We never allow git via SSH or password/key access, and right now, this
causes things to hang forever.  This sets things up to fail quickly
with invalid ssh connections.

BatchMode=yes - passphrase/password querying will be disabled.

StrictHostKeyChecking=yes - never automatically prompt, or add host keys to
the ~/.ssh/known_hosts file, and refuse to connect to hosts whose host key
has changed.
This commit is contained in:
Hans-Christoph Steiner 2017-11-23 21:19:45 +01:00
parent fdbfb4d1a2
commit 09828f4a73
2 changed files with 12 additions and 1 deletions

View file

@ -802,7 +802,14 @@ class vcs_git(vcs):
git_config.append('url.https://u:p@' + domain + '.insteadOf=git://' + domain)
git_config.append('-c')
git_config.append('url.https://u:p@' + domain + '.insteadOf=https://' + domain)
envs.update({'GIT_TERMINAL_PROMPT': '0'}) # supported in git >= 2.3
# add helpful tricks supported in git >= 2.3
ssh_command = 'ssh -oBatchMode=yes -oStrictHostKeyChecking=yes'
git_config.append('-c')
git_config.append('core.sshCommand="' + ssh_command + '"') # git >= 2.10
envs.update({
'GIT_TERMINAL_PROMPT': '0',
'GIT_SSH_COMMAND': ssh_command, # git >= 2.3
})
return FDroidPopen(['git', ] + git_config + gitargs,
envs=envs, cwd=cwd, output=output)