rust-lang / git2-rs

libgit2 bindings for Rust
https://docs.rs/git2
Apache License 2.0
1.69k stars 387 forks source link

Clone with SSH not work if port is not 22 #949

Open ChenhuiZhang opened 1 year ago

ChenhuiZhang commented 1 year ago

Hi,

I have a git server which use different port as default 22, so when I try to clone it with something below:

builder.clone( "foo@git.bar.com:23953/xxxxx", Path::new("/tmp/git2-rs"), )?;

It will timeout, and when I strace the process, I see it try to connect with the server at port 22, I didn't find some way to change the port, does anyone know how to do this? Thanks.

Best Regards, Hermes

ehuss commented 1 year ago

AFAIK, the ssh shorthand syntax doesn't have a place to put the port. It needs to be a full SSH url, as in ssh://user@host:23953/path.