mirror of
https://github.com/git/git.git
synced 2026-04-02 13:00:08 +02:00
Error out rather than hang when plink does not know the host yet
As reported in msysGit issue 96, plink wants to interact with the user asking if a host key should be accepted, but this just blocks the terminal, as plink tries to get the answer from stdin. However, stdin is already connected to Git that wants to send input to the remote command. Rather than blocking, just call plink with -batch so that it will error out with an error message. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
@@ -602,13 +602,15 @@ struct child_process *git_connect(int fd[2], const char *url_orig,
|
||||
die("command line too long");
|
||||
|
||||
conn->in = conn->out = -1;
|
||||
conn->argv = arg = xcalloc(6, sizeof(*arg));
|
||||
conn->argv = arg = xcalloc(7, sizeof(*arg));
|
||||
if (protocol == PROTO_SSH) {
|
||||
const char *ssh = getenv("GIT_SSH");
|
||||
int putty = ssh && strstr(ssh, "plink");
|
||||
if (!ssh) ssh = "ssh";
|
||||
|
||||
*arg++ = ssh;
|
||||
if (putty)
|
||||
*arg++ = "-batch";
|
||||
if (port) {
|
||||
/* P is for PuTTY, p is for OpenSSH */
|
||||
*arg++ = putty ? "-P" : "-p";
|
||||
|
||||
Reference in New Issue
Block a user