src-d / go-git

Project has been moved to: https://github.com/go-git/go-git
https://github.com/go-git/go-git
Apache License 2.0
4.91k stars 542 forks source link

PlainClone cannot update default port #1255

Open mulhauser opened 4 years ago

mulhauser commented 4 years ago

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

alowde commented 4 years ago

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.