PAT authentication

Ideally, we won’t have to use Personal Access Tokens (PAT) for this workshop. However, here are the steps to authenticate access to GitHub.com with PAT.

Here are simple instructions for authenticating Git access to GitHub.com using a Personal Access Token (PAT) for both PC and Mac.

Creating a Personal Access Token (PAT) on GitHub

First, you need to generate a PAT from your GitHub account.

  1. Log in to GitHub: Go to github.com and log in.

  2. Go to Settings: Click on your profile picture in the top-right corner and select Settings.

  3. Developer settings: In the left sidebar, scroll down and click on Developer settings.

  4. Personal access tokens: Click on Personal access tokens, then select Tokens (classic).

  5. Generate new token: Click the Generate new token button. You can also choose Generate new token (beta) if you prefer, but “classic” tokens are widely supported.

  6. Note: Give your token a descriptive Note (e.g., “Git Access”).

  7. Expiration: Choose an Expiration date for your token. For security, it’s best not to select “No expiration.”

  8. Scopes: Select the scopes (permissions) your token needs. For general Git operations, you’ll typically need:

    • repo: This grants full control of private repositories.
  9. Generate token: Click the Generate token button at the bottom.

  10. Copy your token: Immediately copy the generated token. You won’t be able to see it again. Store it securely, as it’s like a password.

Authenticating Git Access with Your PAT

Once you have your PAT, you can use it in two main ways:

Method 1: Using the PAT Directly in the Git Command (Temporary)

This is useful for one-off operations or if you prefer not to store the token long-term in your system’s credential manager.

When prompted for your username and password by Git (e.g., when pushing or pulling), enter:

  • Username: Your GitHub username.

  • Password: Your Personal Access Token (the one you just copied).