The best way to control Claude Code, Codex and more from any computer or phone
fix(shared): recognize SSH remotes with a single path component (#31781)
Co-authored-by: Julius Marminge <julius0216@outlook.com>
Darsh Mahadevia committed
Nov 14, 2026 at 22:08 UTC
bee9eb593939fb89c6aa6c5f308556ca1deb4b5d
2 files changed
+3
-1
packages/shared/src/sourceControl.test.ts
+2
@@ -8,6 +8,7 @@ describe("isSshRemoteUrl", () => {
8
"ssh://git@github.com/owner/repo.git",
9
"github.com:owner/repo.git",
10
"github-work:owner/repo.git",
11
+ "gitserver:repo.git",
12
])("reads %s as SSH", (remoteUrl) => {
13
expect(isSshRemoteUrl(remoteUrl)).toBe(true);
14
});
@@ -19,6 +20,7 @@ describe("isSshRemoteUrl", () => {
20
"./team:group/repo",
21
"file:///srv/git/repo.git",
22
"hg::owner/repo",
23
+ "C:repo.git",
24
])("does not read %s as SSH", (remoteUrl) => {
25
expect(isSshRemoteUrl(remoteUrl)).toBe(false);
26
});
packages/shared/src/sourceControl.ts
+1
-1
@@ -1,7 +1,7 @@
1
const SCP_SSH_REMOTE_PATTERN = /^[a-zA-Z0-9._-]+@([^:/]+):/;
2
// Git reads `host:path` as SSH too, leaving the user to ssh config. A single letter is a Windows
3
// drive and `::` names a remote helper.
4
-const USERLESS_SCP_SSH_REMOTE_PATTERN = /^([^@:/\\\s]{2,}):(?!:)\/?[^/\s]+(?:\/[^/\s]+)+\/?$/u;
4
+const USERLESS_SCP_SSH_REMOTE_PATTERN = /^([^@:/\\\s]{2,}):(?!:)\/?[^/\s]+(?:\/[^/\s]+)*\/?$/u;
5
6
/** Null unless the remote is `host:path`, with no user. */
7
export function userlessScpRemoteHost(remoteUrl: string): string | null {