skillshare icon indicating copy to clipboard operation
skillshare copied to clipboard

Hub install fails for SSH-only GHE users when source uses domain-prefix format

Open dotned opened this issue 5 months ago • 3 comments

Ran into this setting up an internal hub on GitHub Enterprise where all access is via SSH (no PAT / GH_TOKEN configured).

Setup

  • Hub registered via SSH: skillshare hub add [email protected]:Org/skills.git
  • Skillshare v0.20.7

Problem

Installing a skill from the hub fails when the hub JSON source field uses domain-prefix format:

"source": "acme.ghe.com/Org/repo/skills/my-skill"

expandGitHubShorthand converts this to https://acme.ghe.com/... → HTTPS clone with no credentials → auth failure.

This affects both CLI (skillshare search --hub <label> → select → install) and the web UI.

Code path

The issue is in internal/install/source.go — expandGitHubShorthand (line 212), called from ParseSource which is the shared entry point for both CLI and UI:

// If the first segment contains ".", it's a domain (e.g., gitlab.com/user/repo)
// not a GitHub owner — prepend https:// so gitHTTPSPattern can match it
firstSegment := input[:firstSlash]
if strings.Contains(firstSegment, ".") {
    return "https://" + input
}

Any source with a domain (like acme.ghe.com/Org/repo/path) gets https:// prepended unconditionally. No opportunity to try SSH if HTTPS fails.

Workaround

Using SSH format in the hub JSON source field works:

"source": "[email protected]:Org/repo.git//skills/my-skill"

Install succeeds via SSH agent. Preview still doesn't work though (Contents API path has no SSH fallback).

Impact

Source format Install (CLI) Install (UI) Preview
Domain-prefix ❌ ❌ ❌
SSH ✅ ✅ ❌

Thoughts

Either (or both):

  1. Docs — mention in the hub-index guide that SSH-only hosts need SSH format in the source field
  2. Fallback — when HTTPS clone/API gets a 401/403 on a GHE host, try SSH as a graceful fallback (would also fix preview)

Related: #193 (fixed API host resolution in v0.20.6; this covers the remaining auth gap for SSH-only setups)

dotned avatar Jun 04 '26 05:06 dotned

Fixed in v0.20.8.

SSH hubs now rewrite same-host GitHub/GHE domain-prefixed entries to inherit the hub SSH identity, so acme.ghe.com/Org/repo/skills/my-skill from an SSH hub installs over SSH instead of HTTPS. SSH GitHub/GHE previews also fall back to clone when the Contents API is unavailable.

Covered by unit/integration tests. I did not validate against a live private GHE tenant, so please let me know if the issue still reproduces after upgrading. Thanks!

runkids avatar Jun 05 '26 06:06 runkids

Confirmed working on v0.20.9.

Tested with our GHE hub registered via SSH and domain-prefix sources in the hub index:

"source": "ghe.example.com/Org/repo/skills/my-skill"

Results:

  • ✅ CLI: skillshare search --hub → domain-prefix sources rewritten to SSH → install succeeds
  • ✅ Web UI: hub search resolves domain-prefix sources to SSH → install succeeds
  • ✅ Mixed hub (public GitHub shorthand + GHE domain-prefix) works correctly — only same-host entries are rewritten
  • ✅ Preview falls back to clone as expected

The core fix works. Thanks!

dotned avatar Jun 09 '26 04:06 dotned

Noted a couple of minor UI inconsistencies during testing (display formatting, not functional). Will raise separately.

dotned avatar Jun 09 '26 04:06 dotned