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", (...@@ -381,3 +381,18 @@ it("reports unauthenticated when GitHub JSON has accounts but none are valid", (
381 },381 },
382 );382 );
383});383});
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) {...@@ -67,6 +67,16 @@ function parseGitHubAuth(input: SourceControlAuthProbeInput) {
67 });67 });
68 }68 }
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
70 if (input.exitCode !== 0) {80 if (input.exitCode !== 0) {
71 return providerAuth({81 return providerAuth({
72 status: "unauthenticated",82 status: "unauthenticated",
apps/web/src/components/settings/SourceControlSettings.tsx+2-1
...@@ -240,9 +240,10 @@ function itemSummary({...@@ -240,9 +240,10 @@ function itemSummary({
240 </span>240 </span>
241 );241 );
242 }242 }
243 const authDetail = optionLabel(auth.detail);
243 return (244 return (
244 <span>245 <span>
245 Could not verify {item.label}. {item.installHint}246 Could not verify {item.label}. {authDetail ?? item.installHint}
246 </span>247 </span>
247 );248 );
248 }249 }
docs/user/source-control.md+2-1
...@@ -67,7 +67,7 @@ Run a quick **Rescan** after setting up a new machine or changing credentials....@@ -67,7 +67,7 @@ Run a quick **Rescan** after setting up a new machine or changing credentials.
6767
68### For GitHub (Recommended for most users)68### 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:
71 ```bash71 ```bash
72 brew install gh72 brew install gh
73 ```73 ```
...@@ -140,6 +140,7 @@ Control settings**....@@ -140,6 +140,7 @@ Control settings**.
140**Common issues:**140**Common issues:**
141141
142- **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 Settings142- **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
143- **Bitbucket not connecting** – Double-check your environment variables are set in the correct shell profile and the server was restarted144- **Bitbucket not connecting** – Double-check your environment variables are set in the correct shell profile and the server was restarted
144- **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)145- **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