Install
openclaw skills install @haiyangchenbj/github-pat-debugging排查 GitHub PAT 认证失败、401、Bad credentials、推送失败、token 看起来失效等问题。先检查命令、变量传递、路径和请求参数,再用 curl、Node、Python 或 PowerShell 交叉验证,确认后才判断权限、撤销或网络原因。适用于 GitHub API、Contents API、GitHub Pages 和 Skill 镜像推送。 Diagnose GitHub Personal Access Token failures before declaring a token expired or revoked.
openclaw skills install @haiyangchenbj/github-pat-debugging401 Bad credentials.TOKEN=$(cat "$HOME/.workbuddy/connectors/default/tokens/github.txt")
curl -sS -D - -o /dev/null \\
-H "Authorization: Bearer $TOKEN" \\
-H "User-Agent: workbuddy-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.oauth_authorization.destroy as a possible security-log event.GET /repos/{owner}/{repo} — HTTP 200 with private: true means the repo exists and the 404s are permission-based hiding. Cross-validate: authenticated API 200 + unauthenticated raw 404 = private repo working as designed.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.GET /users/{name}/repos lists public repos only, even with a valid token. To audit the full inventory including private repos, call GET /user/repos?visibility=all authenticated as that user — otherwise "repo missing" conclusions are wrong by construction.env or $VAR arrives empty in one runtime but works in another, read the token from its file inside the script instead of relying on env propagation.\r as part of the token and returns 401 regardless of validity — one more reason step 2 inspects byte count and trailing bytes before concluding anything about the token itself.GET /user with the corrected runtime and confirm HTTP 200 plus the expected login, without printing the token.