Windows GitHub Auth Diagnosis
Use this skill before declaring GitHub authentication broken on Windows when the failing command ran inside a Codex, agent, or tool sandbox.
Core Rule
Treat sandbox-only GitHub authentication failures as false-negative candidates until a keyring-capable path proves otherwise. Some Windows agent sandboxes cannot read Credential Manager or another configured keyring even when GitHub CLI and Git are correctly authenticated in a normal terminal.
Do not run or suggest gh auth login, gh auth logout, or gh auth refresh based only on a sandbox HTTP 401, Bad credentials, invalid default token, or SEC_E_NO_CREDENTIALS result.
Known False-Negative Symptoms
gh auth status -h github.com --json hosts returns HTTP 401, Bad credentials, or an invalid default token from a sandboxed command.
gh api user --jq .login returns Requires authentication (HTTP 401) from a sandboxed command.
git ls-remote, git fetch, git pull, or git push over HTTPS fails with schannel: AcquireCredentialsHandle failed: SEC_E_NO_CREDENTIALS from a sandboxed command.
Procedure
Confirm repository remote wiring:
git -C <repo> remote -v
If origin is missing, classify the problem as NO_ORIGIN or remote misconfiguration, not as GitHub authentication failure.
Check credential helper configuration:
git -C <repo> config --get-all credential.helper
git -C <repo> config --get-all credential.https://github.com.helper
Run the proof commands from a keyring-capable execution path without printing token values. In Codex, if sandboxed commands fail with the symptoms above, use the smallest available unsandboxed or approval-backed command path for only these proof commands:
gh auth status -h github.com --json hosts
gh api user --jq .login
GIT_TERMINAL_PROMPT=0 git -C <repo> ls-remote origin HEAD
If a proof command fails in a way that can be transient, such as a network
timeout, a DNS or proxy hiccup, or temporary GitHub unavailability, retry the
same command once before classifying the result. Classify only reproducible
failures.
Treat GitHub authentication as healthy only when all of these are true:
gh auth status reports state=success.
gh auth status reports tokenSource=keyring, the documented keyring-backed source for the environment, or an environment-variable token source such as GH_TOKEN or GITHUB_TOKEN. An environment-variable token does not depend on keyring visibility, so when the remaining proof checks pass it is a valid healthy state, not a false-negative candidate.
gh api user --jq .login returns the expected login.
GIT_TERMINAL_PROMPT=0 git -C <repo> ls-remote origin HEAD returns a ref, unless the remote is intentionally empty and stderr plus exit status show authentication succeeded.
If keyring proof succeeds, classify the sandbox 401, Bad credentials, invalid default token, or SEC_E_NO_CREDENTIALS result as a sandbox false negative. Continue push, PR, review, merge, or other GitHub work through the same keyring-capable execution path.
Exceptions To Preserve
NO_ORIGIN: missing or wrong origin is a remote configuration problem.
- Empty repository:
ls-remote origin HEAD can return no ref for a truly empty remote; inspect stderr and exit status before calling it auth failure.
- Branch protection: push rejection from protected branches is not authentication failure.
- Permission or scope shortage: successful login with a failed operation can still indicate missing repository permission or token scope.
- Network outage: DNS, TLS, proxy, or GitHub availability problems are separate from credential health.
- Agent approval layer rejection: if a tool approval layer blocks
git push or a GitHub command, classify it as an approval or permission-layer blocker, not GitHub auth failure.
Prohibited Responses
- Do not print token values or run commands such as
gh auth token or gh auth status --show-token.
- Do not ask for OAuth, token, secret, or credential entry based only on sandboxed failures.
- Do not run or suggest
gh auth login, gh auth logout, or gh auth refresh until the keyring-capable proof path also fails and no exception explains the result.
- Do not wait in OAuth or token-entry loops.
- Do not paste real secrets, real authentication logs, cookies, screenshots, or customer data into public issues or chat reports.
Reporting Template
When reporting the diagnosis, include only safe facts:
- sandbox symptom and command class, without tokens or secret-bearing logs
- remote wiring result
- credential helper result, with no secret values
- keyring-capable proof result: success or failure
- final classification: false negative, remote misconfiguration, permission/scope issue, branch protection, network issue, approval-layer blocker, or unresolved
- next command to continue, if safe
Note: the repository's private-marker scanner (scripts/scan-private-markers.ps1)
is a best-effort guard against leaking secrets into public artifacts. It does not
recognize every secret format, so always sanitize reports and issues by hand
rather than relying on the scan alone.
1---2name: windows-github-auth-diagnosis3description: Diagnose Windows Codex or agent sandbox GitHub authentication false negatives. Use when sandboxed `gh auth status`, `gh api`, `git fetch`, `git push`, or `git ls-remote` reports HTTP 401, Bad credentials, an invalid default token, `SEC_E_NO_CREDENTIALS`, missing credentials, or when an agent might ask for `gh auth login`, OAuth, or token input based only on a sandbox GitHub auth error.4---56# Windows GitHub Auth Diagnosis78Use this skill before declaring GitHub authentication broken on Windows when the failing command ran inside a Codex, agent, or tool sandbox.910## Core Rule1112Treat sandbox-only GitHub authentication failures as false-negative candidates until a keyring-capable path proves otherwise. Some Windows agent sandboxes cannot read Credential Manager or another configured keyring even when GitHub CLI and Git are correctly authenticated in a normal terminal.1314Do not run or suggest `gh auth login`, `gh auth logout`, or `gh auth refresh` based only on a sandbox HTTP 401, Bad credentials, invalid default token, or `SEC_E_NO_CREDENTIALS` result.1516## Known False-Negative Symptoms1718- `gh auth status -h github.com --json hosts` returns HTTP 401, Bad credentials, or an invalid default token from a sandboxed command.19- `gh api user --jq .login` returns `Requires authentication (HTTP 401)` from a sandboxed command.20- `git ls-remote`, `git fetch`, `git pull`, or `git push` over HTTPS fails with `schannel: AcquireCredentialsHandle failed: SEC_E_NO_CREDENTIALS` from a sandboxed command.2122## Procedure23241. Confirm repository remote wiring:2526 ```bash27 git -C <repo> remote -v28 ```2930 If `origin` is missing, classify the problem as `NO_ORIGIN` or remote misconfiguration, not as GitHub authentication failure.31322. Check credential helper configuration:3334 ```bash35 git -C <repo> config --get-all credential.helper36 git -C <repo> config --get-all credential.https://github.com.helper37 ```38393. Run the proof commands from a keyring-capable execution path without printing token values. In Codex, if sandboxed commands fail with the symptoms above, use the smallest available unsandboxed or approval-backed command path for only these proof commands:4041 ```bash42 gh auth status -h github.com --json hosts43 gh api user --jq .login44 GIT_TERMINAL_PROMPT=0 git -C <repo> ls-remote origin HEAD45 ```4647 If a proof command fails in a way that can be transient, such as a network48 timeout, a DNS or proxy hiccup, or temporary GitHub unavailability, retry the49 same command once before classifying the result. Classify only reproducible50 failures.51524. Treat GitHub authentication as healthy only when all of these are true:5354 - `gh auth status` reports `state=success`.55 - `gh auth status` reports `tokenSource=keyring`, the documented keyring-backed source for the environment, or an environment-variable token source such as `GH_TOKEN` or `GITHUB_TOKEN`. An environment-variable token does not depend on keyring visibility, so when the remaining proof checks pass it is a valid healthy state, not a false-negative candidate.56 - `gh api user --jq .login` returns the expected login.57 - `GIT_TERMINAL_PROMPT=0 git -C <repo> ls-remote origin HEAD` returns a ref, unless the remote is intentionally empty and stderr plus exit status show authentication succeeded.58595. If keyring proof succeeds, classify the sandbox 401, Bad credentials, invalid default token, or `SEC_E_NO_CREDENTIALS` result as a sandbox false negative. Continue push, PR, review, merge, or other GitHub work through the same keyring-capable execution path.6061## Exceptions To Preserve6263- `NO_ORIGIN`: missing or wrong `origin` is a remote configuration problem.64- Empty repository: `ls-remote origin HEAD` can return no ref for a truly empty remote; inspect stderr and exit status before calling it auth failure.65- Branch protection: push rejection from protected branches is not authentication failure.66- Permission or scope shortage: successful login with a failed operation can still indicate missing repository permission or token scope.67- Network outage: DNS, TLS, proxy, or GitHub availability problems are separate from credential health.68- Agent approval layer rejection: if a tool approval layer blocks `git push` or a GitHub command, classify it as an approval or permission-layer blocker, not GitHub auth failure.6970## Prohibited Responses7172- Do not print token values or run commands such as `gh auth token` or `gh auth status --show-token`.73- Do not ask for OAuth, token, secret, or credential entry based only on sandboxed failures.74- Do not run or suggest `gh auth login`, `gh auth logout`, or `gh auth refresh` until the keyring-capable proof path also fails and no exception explains the result.75- Do not wait in OAuth or token-entry loops.76- Do not paste real secrets, real authentication logs, cookies, screenshots, or customer data into public issues or chat reports.7778## Reporting Template7980When reporting the diagnosis, include only safe facts:8182- sandbox symptom and command class, without tokens or secret-bearing logs83- remote wiring result84- credential helper result, with no secret values85- keyring-capable proof result: success or failure86- final classification: false negative, remote misconfiguration, permission/scope issue, branch protection, network issue, approval-layer blocker, or unresolved87- next command to continue, if safe8889> Note: the repository's private-marker scanner (`scripts/scan-private-markers.ps1`)90> is a best-effort guard against leaking secrets into public artifacts. It does not91> recognize every secret format, so always sanitize reports and issues by hand92> rather than relying on the scan alone.