Loading...
Loading...
You MUST use this before running a project-scoped GitHub CLI command (gh pr, issue, repo, api, release, run) against github.com, again before every later gh command in the same session, after a gh command fails with an access error such as "Could not resolve to a Repository", and when asked to check or switch the gh account for the current project. It switches gh to the already logged-in account named by GH_ACC in the project's .env/.env and reports the switch in one line. Not for plain git or SSH operations, gh help or version output, logging in, or hosts other than github.com.
npx skill4agent add sentimony/skills gh-switch.env/.envGH_ACC=<login>ghgh auth token--show-token.env/.envghghgh auth statusgh auth switchghpython3 <skill>/scripts/gh_switch.py [--cwd PATH] [--target OWNER/REPO]--cwdgh--target--repo-RghGH_REPOgh| Exit | Output | What you do |
|---|---|---|
| 0 | nothing | Nothing to switch: the account already matches, or no |
| 0 | | Show this line to the user unchanged, then run the |
| 0 | | Tell the user, then run the command as is |
| 2 | | Report the message; do not run the command until the user fixes the file |
| 3 | The account is not logged in | Suggest |
| 4 | | Report the conflict; do not run the command until the user removes the override or confirms the current credentials |
| 5 | | Report the message; do not run the command |
| 6 | Switch failed or not confirmed | Report it without claiming a switch; do not run the command |
gh auth switchgh pr view <number> --json stategitgh --helpgh <command> --helpgh --versionGH_HOST--hostnameGH_ACC.env/.env--repoGH_REPO.env/.envghGH_ACC.env/.envgit rev-parsegit remote -vgh --versiongh auth status --hostname github.com --json hostsgh auth switch --hostname github.com --user <login>ghgh.env/.env