From: Andreas Jochens <aj@andaco.de>
To: git@vger.kernel.org
Subject: How can I specify a non-standard TCP port for a git+ssh connection?
Date: Fri, 2 Dec 2005 13:48:01 +0100 [thread overview]
Message-ID: <20051202124801.GA20332@andaco.de> (raw)
Hello,
is there a simple way to specify a non-standard TCP port for a git+ssh
connection?
The following small patch would allow to use an URL like
'git+ssh://user@hostname:port/path' to specify an arbitrary
port for the ssh connection.
Regards
Andreas Jochens
connect.c | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/connect.c b/connect.c
index 93f6f80..4b640dd 100644
--- a/connect.c
+++ b/connect.c
@@ -560,7 +560,7 @@ static int git_proxy_connect(int fd[2],
int git_connect(int fd[2], char *url, const char *prog)
{
char command[1024];
- char *host, *path = url;
+ char *host, *port = NULL, *path = url;
char *colon = NULL;
int pipefd[2][2];
pid_t pid;
@@ -597,6 +597,10 @@ int git_connect(int fd[2], char *url, co
path = strdup(ptr);
*ptr = '\0';
+ if ((colon = strchr(host, ':'))) {
+ *colon = '\0';
+ port = colon + 1;
+ }
}
if (protocol == PROTO_GIT) {
@@ -626,7 +630,11 @@ int git_connect(int fd[2], char *url, co
ssh_basename = ssh;
else
ssh_basename++;
- execlp(ssh, ssh_basename, host, command, NULL);
+ if (port)
+ execlp(ssh, ssh_basename, "-p", port, host,
+ command, NULL);
+ else
+ execlp(ssh, ssh_basename, host, command, NULL);
}
else
execlp("sh", "sh", "-c", command, NULL);
next reply other threads:[~2005-12-02 12:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-12-02 12:48 Andreas Jochens [this message]
2005-12-02 16:07 ` How can I specify a non-standard TCP port for a git+ssh connection? Linus Torvalds
-- strict thread matches above, loose matches on Subject: below --
2005-12-02 19:31 linux
2005-12-03 8:06 ` Andreas Jochens
2005-12-03 19:09 ` Junio C Hamano
2005-12-03 21:43 ` Andreas Jochens
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20051202124801.GA20332@andaco.de \
--to=aj@andaco.de \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.