Personal access tokens (PATs) are an alternative to using passwords for authentication to GitHub when using the GitHub API or the command line. PATs can only be used for HTTPS Git operations.
Create token
Enter to your GitHub
Click in your profile photo, then click Settings
In the left sidebar, click Developer settings.
In the left sidebar, click Personal access tokens.
Click Generate new token.
Give your token a descriptive name.
Select the Expiration for the token.
Select the scopes, or permissions, you’d like to grant this token. To use your token to access repositories from the command line, select repo.
Click Generate token.
Use token on the command line
When git asks for ‘password’, enter your token
git push origin master
Username: your_username
Password: your_token
Shell
IMPORTANT! Save the token generated because GitHub won’t allow you to see it again.