Tips for GitHub
- Resolving Issues after Two-Factor Authentication
- Return to a Previous State in Git
- How to Uncommit
- How to Delete a Git Branch
Resolving Issues after Two-Factor Authentication
- After enabling a two-factor authentication in my GitHub account, when
I run the Git
git push
command it throws the following error message:$ git push Username for 'https://github.com': your username Password for 'https://Username@github.com': remote: Invalid username or password. fatal: Authentication failed for 'https://github.com/username/repository.git/'
Solution Creating a GitHub personal access token.
- In the upper-right corner of any page, click 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 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.
- Copy the token to your clipboard. For security reasons, after you navigate off the page, you will not be able to see the token again.
Using a token on the command line.
Once we have a token, we can enter it instead of our password when performing Git operations over HTTPS. Just inter your token after prompted a password and then watch the magic happen…
$ git push origin remote_branch
Username: your_username
Password: your_token
Return to a Previous State in Git
How to reset, revert, and return to previous states in Git
How to Uncommit
How to Uncommit Sensitive Files from Git