Skip to main content

GitHub credential types reference

Reference documentation for all programmatic credential types that can access GitHub, including token formats, lifespan, SSO authorization capabilities, and revocation options.

This article provides a consolidated reference for all programmatic credential types that can access GitHub. Use this reference to audit activity and manage credential revocation, especially during security incidents.

Credential types overview

The following table lists all credential types that can programmatically access GitHub.

Credential typeCredential prefixLifespanRevocationAssociated with
Personal access token (classic)ghp_Long-livedManualUser account
Fine-grained personal access tokengithub_pat_Configurable (up to 1 year, or no expiration)ManualUser account
OAuth app access tokengho_Long-livedManualUser account
GitHub App user access tokenghu_Short-lived (8 hours)Automatic expiry or manualUser account
GitHub App installation access tokenghs_Short-lived (1 hour)Automatic expiryApp installation
GitHub App refresh tokenghr_Long-lived (6 months)ManualUser account
User SSH keyNot applicableLong-livedManualUser account
Deploy keyNot applicableLong-livedManualRepository
GITHUB_TOKEN (GitHub Actions)Not applicableShort-lived (job duration)Automatic expiryWorkflow run

Credential revocation

The following sections describe revocation options for each credential type based on your role. See also Token expiration and revocation.

Note

Enterprise owners have options for bulk actions in major incidents. See Bulk actions for security incidents.

Personal access token (classic)

Fine-grained personal access token

OAuth app access tokens

GitHub App user access tokens

  • Users can revoke their authorization to an GitHub App in their personal account settings. Note that this revokes authorization for all organizations, not just a specific one. See Reviewing and revoking authorization of GitHub Apps.

  • Organization owners can't revoke user authorizations directly, but can suspend or uninstall the app to prevent access to organization resources. See Reviewing and modifying installed GitHub Apps.

  • Enterprise and organization owners cannot directly revoke SSO authorization for individual GitHub App user access tokens.

  • Automatically expires after 8 hours by default. See Token expiration and revocation.

GitHub App refresh tokens

GitHub App installation access tokens

User SSH keys

  • Users can delete the credential via Settings > SSH and GPG keys. See Reviewing your SSH keys.
  • Organization owners and enterprise owners on GitHub Enterprise Cloud with SSO enforced can revoke the SSO authorization for a specific SSH key. Once revoked, the same key cannot be re-authorized—the user must create a new SSH key. See Revoking SSO authorization for details.
  • Automatically deleted if unused for one year. See Deleted or missing SSH keys.

For more information on SSH keys, see Adding a new SSH key to your GitHub account.

Deploy keys

For more information on deploy keys, see Managing deploy keys.

GITHUB_TOKEN (GitHub Actions)

  • Automatically expires: The GITHUB_TOKEN is created at the start of each workflow job and expires when the job completes. There is no manual revocation mechanism. During an incident, you can disable GitHub Actions on the repository to prevent new tokens from being issued.

For more information on GITHUB_TOKEN, see GITHUB_TOKEN.

SSO authorization

When single sign-on (SSO) is required at the enterprise level, enforced at the organization level, or enabled for an organization and a member has linked an identity, certain credential types must be authorized for an organization before they can access organization resources. The following table indicates which credential types can be authorized for an organization.

Token typeSupports SSO authorizationAdmins can revoke SSO authorization
Personal access token (classic)
Fine-grained personal access token
OAuth app access token1
GitHub App user access token1
GitHub App installation access token (not required)Not applicable
GitHub App refresh tokenNot applicable
User SSH key
Deploy key (repository-scoped)Not applicable
GITHUB_TOKEN (GitHub Actions) (repository-scoped)Not applicable

For information on how to authorize a credential for SSO, see Authorizing a personal access token for use with single sign-on, Managing your personal access tokens, and Authorizing an SSH key for use with single sign-on.

Revoking SSO authorization

On GitHub Enterprise Cloud with SSO enforced, when a credential supports SSO authorization, there are two independent containment options:

  • Delete or revoke the credential itself: Permanently removes all access associated with the credential. See the individual credential type sections above for who can perform this action.
  • Revoke the credential's SSO authorization: Blocks the credential from accessing a specific organization's resources without deleting it. Once revoked, the user cannot re-authorize the same credential; they must create a new one.

Enterprise administrators and organization owners can revoke SSO authorization for the credential types marked in the table above:

You can also manage SSO authorizations via the REST API. See REST API endpoints for organizations.

During a security incident, enterprise owners can revoke SSO authorizations in bulk. See Bulk actions for security incidents.

Bulk actions for security incidents

During a major security incident, there are some enterprise-level bulk actions that enterprise owners on GitHub Enterprise Cloud can take to respond quickly. These actions affect user SSH keys, OAuth app user access tokens, GitHub App user access tokens, personal access tokens (classic), and fine-grained personal access tokens. They do not affect GitHub App installation access tokens, deploy keys, or GITHUB_TOKEN.

Warning

These are high-impact actions that should be reserved for major security incidents. They are likely to break automations, and it could take months of work to restore your original state.

Note

For enterprises with personal accounts (non-EMU) that use SSO, the "delete all tokens and keys" option is not available. The "revoke SSO authorizations" action blocks access to SSO-protected organization resources, but does not block credentials from accessing enterprise-level endpoints or resources in organizations that do not enforce SSO. For enterprises without SSO, neither bulk action is available.

Footnotes

  1. SSO authorization is granted automatically when the user authorizes the app during an active SAML or OIDC session. These authorizations are not visible to users or admins in the GitHub UI, and are not returned by the List SAML SSO authorizations for an organization REST API endpoint. 2