mirror of
https://github.com/libgit2/libgit2.git
synced 2026-01-25 11:06:32 +00:00
ssh: Omit port option from ssh command unless specified in remote url
Omit `-p 22` option from ssh command by default. Adding `-p 22` option when a port is not in a remote url causes that `Port` option in a ssh config is ignored.
This commit is contained in:
@@ -158,9 +158,10 @@ static int get_ssh_cmdline(
|
||||
else if ((error = git_config__get_string_buf(&ssh_cmd, cfg, "core.sshcommand")) < 0 && error != GIT_ENOTFOUND)
|
||||
goto done;
|
||||
|
||||
error = git_str_printf(out, "%s -p %s \"%s%s%s\" \"%s\" \"%s\"",
|
||||
error = git_str_printf(out, "%s %s %s \"%s%s%s\" \"%s\" \"%s\"",
|
||||
ssh_cmd.size > 0 ? ssh_cmd.ptr : default_ssh_cmd,
|
||||
url->port,
|
||||
url->port_specified ? "-p" : "",
|
||||
url->port_specified ? url->port : "",
|
||||
url->username ? url->username : "",
|
||||
url->username ? "@" : "",
|
||||
url->host,
|
||||
|
||||
Reference in New Issue
Block a user