Check GitHub CLI authentication status
Verify whether GitHub CLI is already logged in.
gh auth statusUse this when Copilot reports missing auth information and you want to inspect your GitHub CLI auth state.
Commands for diagnosing Copilot CLI authentication failures, token issues, wrapper install problems, and access-policy errors.
Diagnose missing credentials, invalid tokens, and wrong-account problems.
Verify whether GitHub CLI is already logged in.
gh auth statusUse this when Copilot reports missing auth information and you want to inspect your GitHub CLI auth state.
copilot loginThe official fix for missing or expired credentials is often to sign in again.
Inspect the highest-priority token variable.
echo $COPILOT_GITHUB_TOKENIf nothing prints, the variable is not set in the current shell environment.
echo $GH_TOKEN`GH_TOKEN` takes precedence over `GITHUB_TOKEN` but not over `COPILOT_GITHUB_TOKEN`.
echo $GITHUB_TOKENA stale or unexpected value here can lead to wrong-account or permission confusion.
Export a supported token into the current shell.
export COPILOT_GITHUB_TOKEN=PERSONAL_ACCESS_TOKENUse a supported fine-grained token rather than a classic PAT.
Fix common setup blockers related to plans, policies, and keychains.
Check whether your binary is current.
copilot versionA mismatched version is a frequent cause of behavior not matching the docs.
Refresh the binary to the latest release.
copilot updateThis can resolve issues caused by old builds or wrapper download state.
Reset a broken gh wrapper install.
gh copilot --remove && gh copilotUseful when the `gh` wrapper has cached a bad or stale binary.
Install keychain support when secure storage is unavailable.
Install libsecret or accept plaintext credential storage when prompted.The auth troubleshooting guide calls out missing keychain support as a common failure mode.
Verify subscription and org-level Copilot CLI policy.
Check that your Copilot plan is active and that your organization or enterprise has not disabled Copilot CLI.403 and policy-denied errors often come from licensing or admin settings rather than local CLI bugs.
Use lower-risk ways to understand what Copilot is doing and why.
copilot help permissionsUseful when debugging why a tool did or did not run.
Inspect supported environment controls.
copilot help environmentA quick way to confirm environment variable names and behavior.
Check how the session is behaving.
/usageA good checkpoint when responses feel truncated, expensive, or oddly slow.
Check whether the session has too much accumulated context.
/contextLong sessions can lose precision if important details are compressed or summarized.
Reduce context noise before asking again.
/compactA helpful move when the agent starts drifting or repeating itself.
Log out and back in when account state looks wrong.
copilot logout && copilot loginA straightforward fix for wrong-account, revoked token, or cached-credential issues.