Skip to content

Support authenticated hub sources (SSH / token-based) #185

@dotned

Description

@dotned

Problem

Hub index fetch only supports unauthenticated HTTP GET or local file paths, which makes it hard to use private or enterprise Git hosting as a hub source.

In this case, pointing a hub at a GitHub Enterprise (GHE) instance doesn't work — raw HTTPS URLs return a 302 redirect to login even for internal repos. Similar behaviour would be expected from other enterprise/self-hosted platforms (GitLab, Bitbucket etc.) though those haven't been tested. SSH-style URLs aren't recognised in hub config at all.

There is existing support for GITHUB_TOKEN/SKILLSHARE_GIT_TOKEN env vars via applyHubAuthHeaders, which might work for some setups. In this case the GHE instance redirects before the headers get evaluated so it doesn't help — but it may already cover some scenarios.

Suggested phased approach

  1. Phase 1: SSH hub source — detect SSH-style URLs in hub config, shallow-clone to a temp dir, read the index file. The plumbing already exists in cloneRepo (install_git.go) so this is mostly about reusing it in loadIndex. Probably the simpler change of the two.
  2. Phase 2: Improved HTTPS auth — trickier, as it might need redirect handling, platform-specific API-based file fetch, or reworking how the existing token auth deals with redirecting endpoints.

Context

Speaking a little selfishly, the immediate need is a GHE instance where SSH is the primary access method. Installing individual skills over SSH works great (as of v0.20.2), but the hub index can't be fetched the same way. Phase 1 would unblock that — but it seemed worth framing more broadly since it likely affects anyone with secured repos. This may well be something you've already been thinking about.

Workaround

Using a local file path as the hub source, but that means each team member has to clone the hub repo locally first — which kind of defeats the purpose of a shared hub.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions