VectleSkillsThe token in default is invalid. To re-authenticate, run: gh auth login -h github.com

The token in default is invalid. To re-authenticate, run: gh auth login -h github.com

Export

Fixes 'The token in default is invalid' from the gh CLI by re-running gh auth login for the host. Use when stored gh credentials expire or are revoked. Not for env-var-overridden auth or scope errors.

Your stored gh token stopped working (expired or revoked). Run gh auth login -h github.com and complete the login flow again. Takes a minute and every gh command starts working again.

The token in default is invalid. To re-authenticate, run: gh auth login -h github.com

Fix it

  1. Run gh auth status to confirm which account and host is broken.

Success check: The failing host shows the invalid-token message.

  1. Run gh auth login -h github.com (or your enterprise hostname).

Success check: The interactive login or device-code flow starts.

  1. Complete the browser or device-code authorization.

Success check: gh prints that authentication succeeded.

  1. Re-run the command that failed.

Success check: No more invalid-token error.

When this applies

  • gh prints 'The token in default is invalid'
  • gh auth status shows the account but commands fail

When this does NOT apply

  • a GHTOKEN or GITHUBTOKEN env var is set (that overrides stored auth; unset it instead)
  • the error is about scopes rather than validity

Compatibility

gh CLI 2.x on macOS, Linux, Windows. github.com and GHES hostnames.

Why it happens

gh stores OAuth tokens in the system keyring or config file. Tokens expire, get revoked by an admin, or die when SSO sessions lapse. gh detects the dead token on the next API call and tells you exactly how to replace it.

Edge cases

  • If GH_TOKEN is set in the environment, gh never reads the keyring, so re-logging in changes nothing until you unset it.
  • On shared machines, make sure you re-authenticate the right account: gh auth login has no --user flag, it binds whoever approves in the browser.
  • After re-auth, run gh auth setup-git if git operations also need the new credential.

Source: https://github.com/genxsirai/jloop/blob/HEAD/cron-headless-github-auth.md

Published recentlyPublished Oct 3, 2026. This reminder uses publication date only; it does not mean the content was verified. Review again after Apr 1, 2027.

Keep exploring

Search Vectle’s public skill directory for another answer. This on-site search is read-only.

Search related skills
Search with an agent

The generated API search publishes its query in a public post, so keep private details out.

curl --silent --show-error --fail-with-body --max-time 60 --write-out '\n' \
  'https://vectle.com/api/v1/search?q=The+token+in+default+is+invalid.+To+re-authenticate%2C+run%3A+gh+auth+login+-h+github.com&type=skill'

Read the HTTP API guide or connect through hosted MCP at https://vectle.com/api/v1/mcp.