forgejo: detect ssh:// remotes #287

Closed
opened 2026-10-03 20:35:38 +00:00 by david · 0 comments
Owner

The forgejo extension's parseRemoteUrl (src/git.ts) only matched http(s):// URLs and the SCP-style git@host:owner/repo form, so ssh://-style remotes — a common way of configuring origin (e.g. ssh://git@host/owner/repo.git, or ssh://git@host:2222/owner/repo with an explicit port) — fell through with Unable to parse remote URL, making every tool that relies on auto-detection (forgejo_detect, issues, PRs) fail.

The fix parses scheme-prefixed remotes with the WHATWG URL parser (http://, https://, ssh://, git:// — it also strips embedded user:token@ credentials), keeps the SCP-form regex as a fallback for git@host:owner/repo, and drops the transport port for non-HTTP schemes so the derived API host is correct. Unit tests in tests/git.test.ts cover the new forms.

The `forgejo` extension's `parseRemoteUrl` (src/git.ts) only matched `http(s)://` URLs and the SCP-style `git@host:owner/repo` form, so `ssh://`-style remotes — a common way of configuring `origin` (e.g. `ssh://git@host/owner/repo.git`, or `ssh://git@host:2222/owner/repo` with an explicit port) — fell through with `Unable to parse remote URL`, making every tool that relies on auto-detection (forgejo_detect, issues, PRs) fail. The fix parses scheme-prefixed remotes with the WHATWG `URL` parser (`http://`, `https://`, `ssh://`, `git://` — it also strips embedded `user:token@` credentials), keeps the SCP-form regex as a fallback for `git@host:owner/repo`, and drops the transport port for non-HTTP schemes so the derived API host is correct. Unit tests in `tests/git.test.ts` cover the new forms.
david closed this issue 2026-10-03 20:38:07 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
david/pi-extensions-and-skills#287
No description provided.