Skip to content

Create GitHub Personal Access Token

To create a Personal Access Token (PAT):

  1. Ensure you have access and are logged in to GitHub before proceeding.
  2. Go to the New personal access token page.
  3. Choose a token expiration length from the Expiration dropdown list.
    Expiration
  4. Click the Generate token button .
  5. Copy the new token to the clipboard, then save it. Token

Clearing an expired Personal Access Token on MacOS

If an existing Personal Access Token expires, an authentication failure message may appear when you clone, fetch, or push to GitHub.

$ git clone https://example.com
Cloning into 'repo-name'...
remote: Invalid username or password.
fatal: Authentication failed for 'https://example.com'

If this happens, clear the existing Personal Access Token from the OSX Keychain. On subsequent attempts to clone, fetch, or push, you should be prompted for a username and password where you can provide a new Personal Access Token. For more information, see GitHub Docs: Updating credentials from the macOS Keychain.

To clear an existing Personal Access Token:

  • Run the following command, then press Return:
    $ git credential-osxkeychain erase
    host=ghe.company.com
    protocol=https
    

Warning

SSH access to ghe.company.com is not supported.