aboutsummaryrefslogtreecommitdiffstats
path: root/connect.c
diff options
context:
space:
mode:
Diffstat (limited to 'connect.c')
-rw-r--r--connect.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/connect.c b/connect.c
index c75bf52ee2..048fa04917 100644
--- a/connect.c
+++ b/connect.c
@@ -663,6 +663,19 @@ static enum protocol parse_connect_url(const char *url_orig, char **ret_host,
static struct child_process no_fork = CHILD_PROCESS_INIT;
+static const char *get_ssh_command(void)
+{
+ const char *ssh;
+
+ if ((ssh = getenv("GIT_SSH_COMMAND")))
+ return ssh;
+
+ if (!git_config_get_string_const("core.sshcommand", &ssh))
+ return ssh;
+
+ return NULL;
+}
+
/*
* This returns a dummy child_process if the transport protocol does not
* need fork(2), or a struct child_process object if it does. Once done,
@@ -769,7 +782,7 @@ struct child_process *git_connect(int fd[2], const char *url,
if (looks_like_command_line_option(ssh_host))
die("strange hostname '%s' blocked", ssh_host);
- ssh = getenv("GIT_SSH_COMMAND");
+ ssh = get_ssh_command();
if (!ssh) {
const char *base;
char *ssh_dup;