Preflight
What happened?
I have gh logged into two hosts: github.com (personal) and a GitHub Enterprise Server instance. When working with OpenKnowledge, ok uses my public github.com identity even when the workspace's git remote points at the enterprise host. I expected ok to resolve credentials/identity for the host the repo actually lives on, and I couldn't find any config key or env var to change the default host.
Digging into the source, the --host flag on the ok auth subcommands is host-aware, but several core paths are hardcoded to github.com:
packages/cli/src/auth/resolve-auth.ts:42 — resolveAuth calls detectGh() with no host, so gh auth token returns the default (github.com) token and Tier A wins even when the repo's remote is a GHES host.
packages/server/src/sync-engine.ts:68 — SYNC_GH_TOKEN_HOST = 'github.com'; the gh token relayed into every sync git subprocess (OK_GH_TOKEN/OK_GH_TOKEN_HOST) is always the github.com one.
packages/server/src/sync-engine.ts:865,876 — the push-permission probe passes host: 'github.com' unconditionally.
packages/server/src/share/git-context.ts:168-191 — parseGitHubOriginUrl only matches github.com remotes; enterprise remotes classify as non-github, downgrading the push-permission check to unknown.
packages/app/src/lib/transports/auth-query-transport.ts:25 — the app UI always queries auth status/repos for github.com, so it displays the public profile regardless of the workspace's remote.
Suggested direction (happy to open a PR):
- Thread the host parsed from the workspace's origin remote into
resolveAuth/detectGh instead of defaulting to github.com.
- Derive
SYNC_GH_TOKEN_HOST and the push-permission probe host from the repo's origin host.
- Widen
parseGitHubOriginUrl to recognize GHES hostnames.
Steps to reproduce
gh auth login on both github.com and a GitHub Enterprise Server host.
- Open (or sync) an OpenKnowledge workspace whose git origin points at the enterprise host.
- Observe that auth/identity (sync token relay, push-permission check, profile shown in the app) resolves to the github.com account instead of the enterprise one.
Platform
macOS (Apple Silicon)
How did you install OpenKnowledge?
CLI (npm / npx)
Version
0.28.2
Logs, errors, or screenshots
$ gh auth status
github.<enterprise-host>
✓ Logged in to github.<enterprise-host> account <enterprise-user> (keyring)
github.com
✓ Logged in to github.com account <public-user> (keyring)
Preflight
What happened?
I have
ghlogged into two hosts:github.com(personal) and a GitHub Enterprise Server instance. When working with OpenKnowledge,okuses my public github.com identity even when the workspace's git remote points at the enterprise host. I expectedokto resolve credentials/identity for the host the repo actually lives on, and I couldn't find any config key or env var to change the default host.Digging into the source, the
--hostflag on theok authsubcommands is host-aware, but several core paths are hardcoded togithub.com:packages/cli/src/auth/resolve-auth.ts:42—resolveAuthcallsdetectGh()with no host, sogh auth tokenreturns the default (github.com) token and Tier A wins even when the repo's remote is a GHES host.packages/server/src/sync-engine.ts:68—SYNC_GH_TOKEN_HOST = 'github.com'; the gh token relayed into every sync git subprocess (OK_GH_TOKEN/OK_GH_TOKEN_HOST) is always the github.com one.packages/server/src/sync-engine.ts:865,876— the push-permission probe passeshost: 'github.com'unconditionally.packages/server/src/share/git-context.ts:168-191—parseGitHubOriginUrlonly matchesgithub.comremotes; enterprise remotes classify asnon-github, downgrading the push-permission check tounknown.packages/app/src/lib/transports/auth-query-transport.ts:25— the app UI always queries auth status/repos forgithub.com, so it displays the public profile regardless of the workspace's remote.Suggested direction (happy to open a PR):
resolveAuth/detectGhinstead of defaulting to github.com.SYNC_GH_TOKEN_HOSTand the push-permission probe host from the repo's origin host.parseGitHubOriginUrlto recognize GHES hostnames.Steps to reproduce
gh auth loginon bothgithub.comand a GitHub Enterprise Server host.Platform
macOS (Apple Silicon)
How did you install OpenKnowledge?
CLI (npm / npx)
Version
0.28.2
Logs, errors, or screenshots