GitHub Authentication Token Setup for Your Local Repository

Are you Getting 403 errors when pushing updates to your GitHub repo?

If you are getting 403 (forbidden) errors when pushing updates to your GitHub repo then you might need to use a GitHub user authentication token for GitHub Authentication.

GitHub Authentication Changes July 2020

In July of 2020 GitHub announced the deprecation of user passwords for all Git operations.

In August of 2021 GitHub no longer accepted user name and passwords and replaced with user based authentication tokens.

I believe GitHub for Desktop was not affected but all other 3rd party tools were affected by this change.

Steps to Generate and Install a GitHub Authentication Token on Your Repository

Step 1: Generate a GitHub token for your account

Important to note that you can create more than one GitHub token or just one for all repositories under that account. This is up to you, the developer.

To generate a GitHub user authentication token, start by clicking on Developer settings and select Personal access tokens.

On the next screen, You’ll configure the scope and access options for your new GitHub token. Click the Green Generate token button at the bottom of the screen.

Make sure to copy and save this new GitHub token somewhere safe as you’ll only get one chance to copy it when you create it. If you mess this part up, you can just delete the old token and easily generate another.

Video: Creating GitHub Token Authentication

GitHub Token Authentication Requirements for Git Operations

Step 2: Configure GitHub to Use Your Authorization Token

Configure GitHub to Use Your Authorization Token with your repository with the Git remote command. Use the set-url argument and pass are URL with the following parts.

  1. https://
  2. Your GitHub Account name that appears in your GitHub URL
  3. A colon
  4. The GitHub Authentication Token you generated on Step 1.
  5. “”
  6. Same as # 2 (Account Name from URL)
  7. Forward Slash
  8. Your Repository Name

I used Git for Windows Git bash command line to execute this command.

$ git remote set-url origin https://[GitHub Account Name]:[Token][GitHub Repo Name]/[my-secure-repo-name]

Video: Setting the Token on a Local Repo

How to set a GitHub Authentication Token on a Local Repository