Reputation: 1368
I have weird case where I'm being told my IT to use the port inside the ssh URL to connect to a git server. My original ssh config is the following:
Host my-host-alias
HostName redacted.redacted.edu
Port 2222
User git
IdentityFile ~/.ssh/my-ssh-private-key
and I was using the git remote url ssh://git@my-host-alias/path/to/repo.git
. I was getting some weird Auth errors with that config (though basic functionality was still working) so IT instructed me to use the git remote url ssh://[email protected]:2222/path/to/repo.git
and that appeared to work with a manually specified GIT_SSH_COMMAND='ssh -i ~/.ssh/my-private-ssh-key
. So I reconfigured my .ssh/config as follows:
Host redacted.redacted.edu:2222
IdentityFile ~/.ssh/my-ssh-private-key
Suddenly, it seems as if ssh can't parse the Host entry anymore. If I run ssh -Tvvv ssh://[email protected]
I get the following output (snippet):
debug1: /Users/myuser/.ssh/config line 94: Applying options for *
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 48: Applying options for *
debug1: /etc/ssh/ssh_config line 52: Applying options for *
It appears that specifying a Host with a port in the URL breaks the parsing of .ssh/config. Can someone verify this?
Upvotes: 2
Views: 217
Reputation: 1325017
The SSH URI syntax won't use ~/.ssh/config
The SCP syntax used by OpenSSH (1999), from the history of the SSH protocol, predates URI (finalized with RFC 3986, January 2005)
So you need to use my-host-alias:path/to/repo.git
if you want to use .ssh/config
.
Upvotes: 0