go-git icon indicating copy to clipboard operation
go-git copied to clipboard

PlainClone cannot update default port

Open mulhauser opened this issue 5 years ago • 1 comments

Hi,

I'm currently using go-git and I'm facing an issue with PlainClone. Currently I use PlainClone as follow git.PlainClone(path, false, &git.CloneOptions{ Auth: auth, URL: url, // Where url is defined like ssh://<user>@<hostname>:<port> with <port> different than 22 Progress: os.Stdout, } I have search how to override this default definition without success. Is there a manner that I don't know to override it.

Thanks

mulhauser avatar Dec 05 '19 13:12 mulhauser

It appears that in doGetHostWithPortFromSSHConfig() if a server has a definition in the user's SSH config the port will be set to 22 - overriding the port given in the URL regardless. It's not optimal but one workaround is to remove the definition in ~/.ssh/config.

alowde avatar Feb 28 '20 05:02 alowde