X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;ds=sidebyside;f=connect.c;h=a6657b13848b5474ffde7edb0ad60ed969f22852;hb=1f40c7c24d999675df818f9d7824937a964f9f40;hp=8f4d99aef25d66c6c8f0196055dd7df8ecd6ef2d;hpb=4ec99bf080f2d95c7c3d706f65eea1c6b9302f23;p=git.git diff --git a/connect.c b/connect.c index 8f4d99ae..a6657b13 100644 --- a/connect.c +++ b/connect.c @@ -382,8 +382,15 @@ int git_connect(int fd[2], char *url, const char *prog) close(pipefd[0][1]); close(pipefd[1][0]); close(pipefd[1][1]); - if (protocol == PROTO_SSH) - execlp("ssh", "ssh", host, command, NULL); + if (protocol == PROTO_SSH) { + const char *ssh = getenv("GIT_SSH") ? : "ssh"; + const char *ssh_basename = strrchr(ssh, '/'); + if (!ssh_basename) + ssh_basename = ssh; + else + ssh_basename++; + execlp(ssh, ssh_basename, host, command, NULL); + } else execlp("sh", "sh", "-c", command, NULL); die("exec failed");