You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
GitHub account per host + saved token in Settings › Source control (#1528 follow-up) #1533
Part 2 of #1528. electron/github.js now exists: it gets a token from gh auth token --hostname <host>, caches it per host, and sourceControl.invalidateDiscoveryCache() clears that cache.
Remaining:
Settings › Source control: let the user pick the account for each host. Pass it as gh auth token --hostname <host> --user <login> (gh ≥ 2.40). The account list comes from gh auth status --json hosts, which sourceControl.probeGithub already parses.
A saved token for users without gh. Design constraint:electron/secrets.js has safeStorage DISABLED by default. On macOS the keychain item's ACL pins the creating binary's code signature, so every rebuild prompted for the login-keychain password. A saved token needs a different store, for example security add-generic-password with -T /usr/bin/security, or the plaintext settings file with a warning. Decide that before building the UI.
githubToken() should check the saved token or the chosen account before the default gh account.
Implemented in bcab6b1c on coder/talk-to-github-through-its-api-instead-o-04dd2a.
New setting settings.githubHosts holds [{host, account, token}] rows. Token lookup order: saved token, then gh auth token --hostname <host> --user <account>, then gh's active account.
Storage decision: tokens go through secrets.js, the same as linearApiKey: plaintext while safeStorage stays disabled, sealed if it's re-enabled. So there are no keychain prompts after rebuilds. Unlike linearApiKey, the token never reaches the renderer: settings come back as {host, account, hasToken}, and a row saved without a token key keeps the stored token.
Settings › Source control › GitHub now has a per-host account picker (logins come from gh auth status --json hosts), a token field with Save/Clear, and "Add host" for GHE with a token only.
Tests: typecheck clean; renderer 2693/0; electron 4113/0 with a CI-style env.
Known limit: the remaining gh CLI fallback paths still use gh's active account. #1534 moves those calls onto the API.
Activity
currentbits commentedon Oct 9, 2026
Implemented in bcab6b1c on
coder/talk-to-github-through-its-api-instead-o-04dd2a.settings.githubHostsholds[{host, account, token}]rows. Token lookup order: saved token, thengh auth token --hostname <host> --user <account>, then gh's active account.secrets.js, the same aslinearApiKey: plaintext while safeStorage stays disabled, sealed if it's re-enabled. So there are no keychain prompts after rebuilds. UnlikelinearApiKey, the token never reaches the renderer: settings come back as{host, account, hasToken}, and a row saved without atokenkey keeps the stored token.gh auth status --json hosts), a token field with Save/Clear, and "Add host" for GHE with a token only.Known limit: the remaining
ghCLI fallback paths still use gh's active account. #1534 moves those calls onto the API.Talk to GitHub through its API instead of the gh CLI (#1528)
Talk to GitHub through its API instead of the gh CLI (#1528) (#1550)
Talk to GitHub through its API instead of the gh CLI (#1528)