answered from live GitHub & Hugging Face data
How do I revoke a fine-grained PAT used by my AI coding agent like Codex?
Revoke the token in GitHub settings, then replace it. Do not rely on the agent to stop using it. A revoked token stops working for all Git and API requests, and it cannot be restored.
Steps
Option A: Revoke a token you own (personal account)
- Open GitHub. Click your profile picture, then click Settings.
- In the left sidebar, click Developer settings.
- Click Personal access tokens, then click Fine-grained tokens.
- Find the token that Codex uses. Click its name, then revoke or delete it.
I could not confirm the exact delete button label from the docs I read. The page text was cut off before the section on deleting a single token. Check the page in your browser.
Option B: Revoke a token used on an organization (org owners only)
- Click your profile picture, then click Your organizations. Select the organization.
- Click Settings. If you cannot see it, use the ⋯ menu, then click Settings.
- In the left sidebar, under Personal access tokens, click Active tokens.
- Click the token name, then click Revoke. To revoke several, select them and click Revoke....
The docs say the token creator receives an email when a token is revoked. (Reviewing and revoking personal access tokens in your organization)
Emergency option: revoke all credentials
Use this only if you think your account is compromised. Go to Settings, then Credentials, then Revoke all. This removes SSO access to enterprise resources. It does not delete tokens. (Revoking your credentials)
What happens after you revoke
- Any job that uses the token fails. Codex runs that depend on it stop.
- Revocation does not remove SSH keys that the token created. The docs say those keys keep working. (Reviewing and revoking personal access tokens in your organization)
- Check for other copies of the token. Remove it from CI secrets, shell profiles and agent config files.
- Confirm the revocation in your security log. The docs say a revoked token can appear as an
oauth_authorization.destroyaction. (Token expiration and revocation)
Check for a leak
If the token may have been pushed to a public repository or gist, GitHub revokes it automatically. Check your security log anyway. (Token expiration and revocation)
Replace the token
- GitHub says personal access tokens are for your own access. For organization access or long-lived integrations, GitHub recommends a GitHub App. (Managing your personal access tokens)
- Set an expiration on any new fine-grained token. GitHub revokes a token after one year without use. (Managing your personal access tokens)
I did not verify how Codex authenticates to GitHub. Check the Codex settings for the place where it stores the token.
If you run more than one agent, use a separate identity for each. githug gives each agent its own key. That key mints GitHub tokens that last one hour and work on one repository. Revoking one agent then does not affect the others.