Install
openclaw skills install @haiyangchenbj/github-pat-debuggingDiagnose GitHub Personal Access Token failures — 401 Bad credentials, push failures, tokens that appear valid but fail — before declaring them expired or revoked. Checks the command, variable propagation, and request parameters first, then cross-validates with curl, Node.js, Python, or PowerShell, and only then investigates permission, revocation, or network causes. Covers the GitHub REST API, Contents API, and file-push workflows. 中文摘要:GitHub PAT 认证排障。先查命令、环境变量传递与请求参数,再用 curl/Node/Python 交叉验证,最后才判断权限、撤销或网络原因。触发词:GitHub token 失效排查、401 Bad credentials、PAT 认证失败、推送失败诊断.
openclaw skills install @haiyangchenbj/github-pat-debugging401 Bad credentials.Diagnostic skill: steps 1–3 are
[Deterministic](shell commands and file inspection); steps 4–8 mix[Deterministic]probes with[LLM]interpretation.
TOKEN=$(cat "$HOME/.github-token")
curl -sS -D - -o /dev/null \
-H "Authorization: Bearer $TOKEN" \
-H "User-Agent: token-probe" \
-H "Accept: application/vnd.github+json" \
https://api.github.com/user
TOKEN=$(cat file) && node script.js (shell variable is not exported).export TOKEN="$(cat file)" && node script.js.TOKEN="$(cat file)" node script.js.process.env.TOKEN only as a boolean/presence signal; never print the value. Test both Bearer and token schemes if needed.200 with X-OAuth-Scopes and Node is 401, inspect environment propagation before token state, proxy, or GitHub account hypotheses.references/token-failure-modes.md: manual deletion/revocation, secret-scanning revocation, third-party credential revocation, OAuth-app token limits, organization/enterprise policy, or expiration.VAR=value command exports the variable only to that command; VAR=value && command does not export it to the later command.401 from Node with process.env.TOKEN unset is a local process bug, not evidence of a revoked PAT.Never used or a stale "last used" label is weaker evidence than a live authenticated GET /user; use the latter for runtime validation.| Scenario | Action |
|---|---|
| curl succeeds but Node fails | Environment propagation bug — inspect export usage before touching the token |
| Both clients fail with 401 | Walk references/token-failure-modes.md decision tree; check security log events |
| Token file unreadable or empty | Fix file access first; an unreadable token is not a revoked token |
| Intermittent failures | Suspect proxy, rate limiting, or SSO enforcement before token state |
| Token confirmed exposed | Rotate immediately after completing the critical deployment |
# GitHub PAT Diagnosis
## 1. Symptom (endpoint, status, runtime, exact command form)
## 2. Local-cause check (variable propagation, env, shell syntax)
## 3. Cross-validation results (curl / Node / Python, status codes)
## 4. Root cause (with evidence strength per references/token-failure-modes.md)
## 5. Fix applied (exact command correction)
## 6. Post-fix verification (GET /user 200 + write SHA + raw file check)
GET /user with the corrected runtime and confirm HTTP 200 plus the expected login, without printing the token.