Repo inference uses the SSH host as the API host #342

Closed
opened 2026-11-29 21:36:52 +00:00 by stephen · 0 comments
Owner

With a Fjord forge remote like ssh://git@ssh.commons.fjord.host/skyview-ptsa/site.git, fj pr list sends its API request to https://ssh.commons.fjord.host/api/v1/.... That host serves git over SSH only, so the request fails with error: sending HTTP request.

Passing --host commons.fjord.host doesn't help. git::remote::discover compares the preferred host with the parsed remote host (ssh.commons.fjord.host), finds no match, and reports repository not specified and could not be inferred from git remote. The only workaround is --host plus -R.

Cause

parse_remote returns the git transport host as RemoteRepo.host, and callers treat it as the web/API host. On Fjord forges the SSH endpoint lives on a separate ssh.<forge> name (portless git SSH), so the two hosts differ.

Fix

When the remote uses an SSH transport (an ssh:// URL or the scp form) and its host starts with ssh., resolve the API host to the parent name. An https://ssh.example/... remote is a real web host and stays as it is. The --host match in discover then works too, because both sides compare the web host.

Tests for both URL forms, the https case, and discover with a preferred host.

With a Fjord forge remote like `ssh://git@ssh.commons.fjord.host/skyview-ptsa/site.git`, `fj pr list` sends its API request to `https://ssh.commons.fjord.host/api/v1/...`. That host serves git over SSH only, so the request fails with `error: sending HTTP request`. Passing `--host commons.fjord.host` doesn't help. `git::remote::discover` compares the preferred host with the parsed remote host (`ssh.commons.fjord.host`), finds no match, and reports `repository not specified and could not be inferred from git remote`. The only workaround is `--host` plus `-R`. ## Cause `parse_remote` returns the git transport host as `RemoteRepo.host`, and callers treat it as the web/API host. On Fjord forges the SSH endpoint lives on a separate `ssh.<forge>` name (portless git SSH), so the two hosts differ. ## Fix When the remote uses an SSH transport (an `ssh://` URL or the scp form) and its host starts with `ssh.`, resolve the API host to the parent name. An `https://ssh.example/...` remote is a real web host and stays as it is. The `--host` match in `discover` then works too, because both sides compare the web host. Tests for both URL forms, the https case, and `discover` with a preferred host.
Sign in to join this conversation.
No milestone
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
rasterstate/fj#342
No description provided.