A github Personal Access Token (PAT) is a long string of characters that is used in place of a password to authenticate git/github operations. You could configure your PAT to permit just certain actions be performed with it as we'll see. This prevents a total disaster from occurring with your account if somehow someone somewhere got access to your credentials.
Follow these steps to generate your Personal Access Token.
Generating a github personal access token.
Step 1: Sign in to github
Step 2: Click on your profile photo at the upper right corner of the page, then click on Settings
Step 3: Scroll down and click on the Developer settings option in the left pane
Step 3: Select the Personal access tokens option in the left pane
Step 4: Click on the Generate new token action. You might be prompted to enter your github password after you've clicked on it.
Step 5: Provide a descriptive name for your token
Step 6: Select an expiration date for your token. Your token will expire after the set period and you'll need to regenerate a new one. You can choose Never if you do not want your token to expire.
Step 7: Select the scopes/privileges you'd want your token to have. You'll need to at least have the repo scope selected to be able to push codes to your repository.
Step 8: Finally, click on Generate token to generate your token.
Step 9: There you have your token. Note that if you do not copy it now, you'll never find it again once you refresh that page, leaving you with the only option of regenerating a new one.
Hope that was easy. Till we meet again, adieu.