From 41b581eafd0a49a7b2f382340691de3df815ef04 Mon Sep 17 00:00:00 2001 From: l0ng-ai Date: Sat, 14 Nov 2026 22:57:59 +0800 Subject: [PATCH] fix(github): recognise remotes cloned through ssh.github.com (#3391) A clone over GitHub's SSH-over-HTTPS host (ssh://git@ssh.github.com:443/o/r.git or git@ssh.github.com:o/r.git) wasn't recognised as a GitHub repository. parseGitHubRemote now accepts ssh.github.com for SSH remotes; https://ssh.github.com stays rejected. Sibling of #3379. --- src/features/github/data/data.test.ts | 3 +++ src/features/github/data/model.ts | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/features/github/data/data.test.ts b/src/features/github/data/data.test.ts index 703de25e2..97efc9f6a 100644 --- a/src/features/github/data/data.test.ts +++ b/src/features/github/data/data.test.ts @@ -401,6 +401,9 @@ describe("pull request helpers", () => { "ssh://git@github.com/o/r.git", "ssh://git@github.com:22/o/r.git", "git://github.com/o/r", + // GitHub's SSH-over-HTTPS host. + "ssh://git@ssh.github.com:443/o/r.git", + "git@ssh.github.com:o/r.git", ]) expect(parseGitHubRemote(url), url).toEqual({ owner: "o", name: "r" }); expect(parseGitHubRemote("https://gitlab.com/o/r.git")).toBeNull(); diff --git a/src/features/github/data/model.ts b/src/features/github/data/model.ts index 492ea2933..66aae9de9 100644 --- a/src/features/github/data/model.ts +++ b/src/features/github/data/model.ts @@ -413,10 +413,10 @@ export function repositoryDisplayName( return showOwner ? `${repo.owner}/${repo.name}` : repo.name; } -/** `owner/name` of a github.com remote URL (https, ssh or scp-like), else null. */ +/** `owner/name` of a github.com remote URL (https, ssh or scp-like; SSH also via ssh.github.com), else null. */ export function parseGitHubRemote(url: string): GHRepositoryCoordinates | null { const m = - /^(?:https?:\/\/(?:[^@/]+@)?|ssh:\/\/(?:[^@/]+@)?|git:\/\/|(?:[^@/]+@)?)(?:www\.)?github\.com(?::\d+(?=\/))?[:/]+([^/]+)\/([^/]+?)(?:\.git)?\/?$/i.exec( + /^(?:(?:https?:\/\/(?:[^@/]+@)?|git:\/\/)(?:www\.)?|(?:ssh:\/\/(?:[^@/]+@)?|(?:[^@/]+@)?)(?:www\.|ssh\.)?)github\.com(?::\d+(?=\/))?[:/]+([^/]+)\/([^/]+?)(?:\.git)?\/?$/i.exec( url.trim(), ); return m ? { owner: m[1]!, name: m[2]! } : null;