PowerShell / PowerShell/Win32-OpenSSH
Host resolution error when using Git, ssh:// URLS and custom ports
Nobody has claimed this yet.
- Dominant language
- No language data
- Stars
- 8.3k
- Forks
- 819
- PR merge metrics
- No merged PRs in 30d
Description
"OpenSSH for Windows" version
7.7.2.1
Client version, although in verbose mode it claims "OpenSSH 8.2p1" in debug output (see below)
Server OperatingSystem
Linux
Client OperatingSystem
Windows 10 Home
Trying to use a SSH Git url with a custom port like ssh://git@git.host.com:9022/Owner/Foo.git tries to access completely the wrong host; it seems to be taking the port number and turning it into an IP address.
> write $env:GIT_SSH
C:\WINDOWS\System32\OpenSSH\ssh.exe
> git remote -v
origin ssh://git@git.host.com:9022/Owner/Foo.git (fetch)
origin ssh://git@git.host.com:9022/Owner/Foo.git (push)
> git fetch
OpenSSH_8.2p1, OpenSSL 1.1.1f 31 Mar 2020
debug1: Reading configuration data /c/Users/steve/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug2: resolve_canonicalize: hostname 9022 is address
debug2: resolve_canonicalize: canonicalised address "9022" => "0.0.35.62"
debug2: ssh_connect_direct
debug1: Connecting to 0.0.35.62 [0.0.35.62] port 22.
debug1: connect to address 0.0.35.62 port 22: Network is unreachable
ssh: connect to host 0.0.35.62 port 22: Network is unreachable
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
If I use plink.exe (from PuTTY) instead for this same URL / repo, everything works fine.
Also, if I change the URL to git@git.host.com:Owner/Foo.git, and then set up ~/.ssh/config to specify the port as 9022, everything works with OpenSSH. So it's specifically when using the ssh:// form.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure on Windows 10 with OpenSSH 7.7.2.1 using the shown Git ssh:// URL and custom port, then compare it with the scp-style URL and SSH config workaround. Done means the ssh:// form resolves git.host.com and connects on port 9022 instead of treating 9022 as the hostname.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git
- Domain
- networking, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100