diff --git a/src/main/github/auth-diagnose.ts b/src/main/github/auth-diagnose.ts index b356bf7b6..aeaf4b9e2 100644 --- a/src/main/github/auth-diagnose.ts +++ b/src/main/github/auth-diagnose.ts @@ -128,8 +128,12 @@ export async function diagnoseGhAuth(): Promise { ? REQUIRED_SCOPES.filter((s) => !active.scopes.includes(s)) : [...REQUIRED_SCOPES] // Is there a non-env (keyring) account we could fall back to by unsetting - // the env var? Only meaningful if the active account is env-shadowed. - const keyringFallback = accounts.find((a) => a.source === 'keyring') ?? null + // the env var? Only meaningful if the active account is env-shadowed, and + // only if the keyring login is on the SAME host — otherwise unsetting the + // env var leaves the user with no credential for the host that was active. + const keyringFallback = active + ? (accounts.find((a) => a.source === 'keyring' && a.host === active.host) ?? null) + : null return { ghAvailable, activeAccount: active, diff --git a/src/renderer/src/components/github-project/GhAuthErrorHelp.tsx b/src/renderer/src/components/github-project/GhAuthErrorHelp.tsx index 31cbf6c64..793bfec55 100644 --- a/src/renderer/src/components/github-project/GhAuthErrorHelp.tsx +++ b/src/renderer/src/components/github-project/GhAuthErrorHelp.tsx @@ -216,14 +216,13 @@ export function GhAuthErrorHelp({ ))} {docsUrl ? ( - openExternal(docsUrl)} className="inline-flex items-center gap-1 rounded border border-amber-500/30 px-1.5 py-0.5 text-[11px] hover:bg-amber-500/20" > Docs - + ) : null}