Skip to content

fix: map SSH-over-443 endpoint hosts (ssh.github.com, altssh.gitlab.com) to their web domains - #239

Open
MAHcodes wants to merge 1 commit into
paulirish:masterfrom
MAHcodes:fix/ssh-over-443-host-alias
Open

MAHcodes wants to merge 1 commit into
paulirish:masterfrom
MAHcodes:fix/ssh-over-443-host-alias

Conversation

@MAHcodes

Copy link
Copy Markdown

Summary

When a repo's remote points at GitHub's SSH-over-HTTPS endpoint (ssh.github.com, the official endpoint for networks where port 22 is blocked), git open produced a broken URL:

  • git@ssh.github.com:user/repo.git → https://ssh.github.com/user/repo ❌
  • ssh://git@ssh.github.com:443/user/repo.git → https://ssh.github.com/user/repo ❌

ssh.github.com is the SSH transport host only — there is no website there. This PR normalizes the domain after URL parsing so these remotes map to their regular web domains:

  • ssh.github.com → github.com
  • altssh.gitlab.com → gitlab.com (GitLab.com's equivalent SSH-over-443 endpoint)

The normalization happens after scp-style/ssh:// parsing and after ssh_config alias resolution, so remotes that resolve to these hosts via ~/.ssh/config are handled too.

Testing

  • Added 3 regression tests to test/git-open.bats:
    • gh: ssh-over-443 endpoint (ssh.github.com) with scp-like syntax
    • gh: ssh-over-443 endpoint (ssh://git@ssh.github.com:443)
    • gitlab: ssh-over-443 endpoint (altssh.gitlab.com)
  • Full suite passes locally: bats test/ → 71/71 ok

Disclosure: AI assistance

The changes in this PR, as well as this pull request itself, were made with the assistance of an AI coding agent (OpenCode), used by @MAHcodes. The bug was reported, the fix and tests were reviewed and verified locally (test suite run included above), and the submission was approved by @MAHcodes.

git@ssh.github.com:user/repo.git (GitHub's official SSH-over-HTTPS
endpoint, used when port 22 is blocked) produced
https://ssh.github.com/user/repo, which doesn't exist.

Normalize ssh.github.com -> github.com and GitLab's equivalent
altssh.gitlab.com -> gitlab.com after parsing the remote URL.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant