back to blogs
deploying forkbum.com, part 2

The second blocker to deploying my website related to authentication errors with github. This post details what I did to fix those issues to deploy my wesite via Github Pages. The following information is only applicable to MacOS and Linux users. (Review the first blocker here.)

> the problem

On July 30, 2020, GitHub Security published this article announcing that GitHub will no longer be using passwords when authenticating with REST APIs on GitHub.com and developers can begin using token-based authentication on November 2020. A December 15, 2020 article was subsequently published providing more information, including the announcement that passwords will no longer be accepted when authenticating on August 13, 2021 and after.

August 13 was pretty recent to the date I deployed/published my site, and I had not known about it, so it caused me some confusion.

Basically, I kept receiving this error when attempting to push my build to the gh-pages branch (to publish my website):

remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.

remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information.

fatal: Authentication failed for 'https://github.com/myUsername/myRepo.git/'
> the solution

In hindsight, this isn't as much of a catastrophic issue as the previous build issue, but I figured this walkthrough could be helpful for some.

Note: if your repositories use SSH, you can authenticate via SSH keys.

Alright - first, follow these steps to create a personal access token.

  1. Sign in to github.com, and navigate to Settings under your account drop-down menu.
  2. Click Developer settings.
  3. Click Personal access tokens.
  4. Click Generate new token.
  5. Enter a descriptive name for the token, and set its time to expire.
  6. Select the permissions to grant for this token.
  7. When finished with setting token attributes (steps 5 and 6), click Generate token.
  8. You should be able to see your generated token, which should look like: "ghp_[random alphanumeric characters]". You can either cache it or store it in a textfile. (Lol make sure not to store it in file in your project filesystem.)

After token generation, you will need to open your terminal and enter these commands:

$ git config --global user.name "githubUsername"

$ git config --global user.email "githubEmailAddress"

$ git remote set-url origin https://<tokenStream>@github.com/<githubUsername>/<reponame>.git

After these changes, you should be able to push to the publishing branch!

© 2022