To ensure this doesn't get lost—after all, setting up a GitHub Personal Access Token isn't something you do constantly, so it doesn't become routine—
Once we are logged into GitHub, we can access it via
Settings → Developer settings → Personal access tokens
to the location where the tokens can be generated. You can choose between Fine-grained tokens and Tokens (Classic). The difference lies in the granular assignment of permissions for the selected repository.
For our purposes, we select Fine-grained tokens and confirm “Generate new token”. After the second 2FA authentication, you will be taken to the input fields
By selecting one or more repositories under “Only select repositories”, you can add various permissions in the “Permissions” section and set access to either “Read-only” or “Read and write”. Upon initiating token generation, you are presented with a summary to confirm, and that is all there is to it. The result is a relatively long string — starting with “github_pat_*******” — which you should copy to your clipboard for future use.
That was the easier part. However, we want to configure Git on our workstation or laptop so that we don't have to enter the Git username and that long token every time we push or pull.