Repository navigation
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 openproduced 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.comis 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.comaltssh.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/configare handled too.Testing
test/git-open.bats:gh: ssh-over-443 endpoint (ssh.github.com) with scp-like syntaxgh: ssh-over-443 endpoint (ssh://git@ssh.github.com:443)gitlab: ssh-over-443 endpoint (altssh.gitlab.com)bats test/→ 71/71 okDisclosure: 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.