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

This commit is contained in:
Theo Browne authored and GitHub committed 2026-08-19 16:35:30 -04:00
1 parent 8c85b4933f
commit 51341f2ac1
4 files changed
+29 -2

No files matched your search

@@ -381,3 +381,18 @@ it("reports unauthenticated when GitHub JSON has accounts but none are valid", (
},
);
});
it("reports an update hint instead of unauthenticated when gh predates --json", () => {
const auth = GitHubSourceControlProvider.discovery.parseAuth(
processResult("", {
stderr: "unknown flag: --json\n\nUsage: gh auth status [flags]\n",
exitCode: ChildProcessSpawner.ExitCode(1),
}),
);
assert.strictEqual(auth.status, "unknown");
assert.match(
Option.getOrElse(auth.detail, () => ""),
/2\.81\.0/,
);
});
@@ -67,6 +67,16 @@ function parseGitHubAuth(input: SourceControlAuthProbeInput) {
});
}
// gh gained `auth status --json` in 2.81.0. Older versions reject the flag and exit
// non-zero, which reads exactly like a signed-out CLI. Name the real problem instead.
if (input.exitCode !== 0 && output.includes("unknown flag: --json")) {
return providerAuth({
status: "unknown",
detail:
"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.",
});
}
if (input.exitCode !== 0) {
return providerAuth({
status: "unauthenticated",
@@ -240,9 +240,10 @@ function itemSummary({
</span>
);
}
const authDetail = optionLabel(auth.detail);
return (
<span>
Could not verify {item.label}. {item.installHint}
Could not verify {item.label}. {authDetail ?? item.installHint}
</span>
);
}
+2 -1
View File
@@ -67,7 +67,7 @@ Run a quick **Rescan** after setting up a new machine or changing credentials.
### For GitHub (Recommended for most users)
1. Install the GitHub CLI on the machine running T3 Code:
1. Install the GitHub CLI (version 2.81.0 or newer) on the machine running T3 Code:
```bash
brew install gh
```
@@ -140,6 +140,7 @@ Control settings**.
**Common issues:**
- **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
- **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
- **Bitbucket not connecting** – Double-check your environment variables are set in the correct shell profile and the server was restarted
- **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)