Problem: You try to clone/pull/push to a GitHub repo and you have 2FA enabled. It asks for your password, you give it, and you’re told “Invalud username or password” and/or “Authentication failed for your_reponame.”
root@f5bcc0000a:/# git clone https://github.com/awesometoast/professorcoolbread
Cloning into 'professorcoolbread'...
Username for 'https://github.com': awesometoast
Password for 'https://awesometoast@github.com':
remote: Invalid username or password.
Solution: You need to use a personal access token instead of your password.
Make one by logging in to your GitHub account. Mash your avatar in the top right, then mash Settings. At the bottom of the sidebar on the left, you’ll see Developer Settings. Mash that.
Or you can just use this URL: https://github.com/settings/tokens
Hit Generate new token near the top of the page.
When you’re asked to “Select scopes”, click repo. You can add more if you need to, but this is the minimum.
Hit the green Generate token button at the bottom of the page. GitHub will hit you back with your new token.
Save that token somewhere secure. Next time you try to git from a command line, paste that token instead of your password. Don’t worry, you won’t need to do this every time.