authorgravatar for me@t3.ggTheo Browne <me@t3.gg> 2026-08-19 16:35:30-04:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-08-19 16:35:30-04:00
log51341f2ac1e25032efac13ef6e9652e9c74b48a3
treefab2540de6c73b5d563402f56318017812ac2447
parent8c85b4933fb7202c2d48e4c8f8ea0e1cfdbcdc29
signature Signed by PGP key B5690EEEBB952194

fix(server): outdated gh no longer reads as "not authenticated" (#7588)


4 files changed, 29 insertions(+), 2 deletions(-)

apps/server/src/sourceControl/GitHubSourceControlProvider.test.ts+15
......@@ -381,3 +381,18 @@ it("reports unauthenticated when GitHub JSON has accounts but none are valid", (
381381 },
382382 );
383383});
384
385it("reports an update hint instead of unauthenticated when gh predates --json", () => {
386 const auth = GitHubSourceControlProvider.discovery.parseAuth(
387 processResult("", {
388 stderr: "unknown flag: --json\n\nUsage: gh auth status [flags]\n",
389 exitCode: ChildProcessSpawner.ExitCode(1),
390 }),
391 );
392
393 assert.strictEqual(auth.status, "unknown");
394 assert.match(
395 Option.getOrElse(auth.detail, () => ""),
396 /2\.81\.0/,
397 );
398});
apps/server/src/sourceControl/GitHubSourceControlProvider.ts+10
......@@ -67,6 +67,16 @@ function parseGitHubAuth(input: SourceControlAuthProbeInput) {
6767 });
6868 }
6969
70 // gh gained `auth status --json` in 2.81.0. Older versions reject the flag and exit
71 // non-zero, which reads exactly like a signed-out CLI. Name the real problem instead.
72 if (input.exitCode !== 0 && output.includes("unknown flag: --json")) {
73 return providerAuth({
74 status: "unknown",
75 detail:
76 "GitHub CLI is too old to report sign-in status. Update `gh` to 2.81.0 or newer (for example `brew upgrade gh`) and rescan.",
77 });
78 }
79
7080 if (input.exitCode !== 0) {
7181 return providerAuth({
7282 status: "unauthenticated",
apps/web/src/components/settings/SourceControlSettings.tsx+2-1
......@@ -240,9 +240,10 @@ function itemSummary({
240240 </span>
241241 );
242242 }
243 const authDetail = optionLabel(auth.detail);
243244 return (
244245 <span>
245 Could not verify {item.label}. {item.installHint}
246 Could not verify {item.label}. {authDetail ?? item.installHint}
246247 </span>
247248 );
248249 }
docs/user/source-control.md+2-1
......@@ -67,7 +67,7 @@ Run a quick **Rescan** after setting up a new machine or changing credentials.
6767
6868### For GitHub (Recommended for most users)
6969
701. Install the GitHub CLI on the machine running T3 Code:
701. Install the GitHub CLI (version 2.81.0 or newer) on the machine running T3 Code:
7171 ```bash
7272 brew install gh
7373 ```
......@@ -140,6 +140,7 @@ Control settings**.
140140**Common issues:**
141141
142142- **Provider shows "Not authenticated"** – Run the login command for that provider (e.g., `gh auth login`) in a terminal on the server, then rescan in Settings
143- **GitHub says it could not verify sign-in status** – T3 Code needs GitHub CLI 2.81.0 or newer to check sign-in status. Update `gh` (e.g., `brew upgrade gh`), then rescan
143144- **Bitbucket not connecting** – Double-check your environment variables are set in the correct shell profile and the server was restarted
144145- **Can't push to a remote** – Verify your Git remote URL matches the provider you've authenticated with (SSH vs HTTPS remotes may need different credentials)
145146