Reset git credentials on a Mac

I tried doing a git push to my HTTPS GitHub remote, but received this error:

remote: Invalid username or password.
fatal: Authentication failed for ''

So I found out I needed to reset my git credentials using this command (note: after entering this multi-line command, you shouldn’t get any output and that’s okay).

git credential-osxkeychain erase

Then, the next time you git push, you should be prompted for your GitHub username and password. The username to enter was obvious, but GitHub no longer supports account passwords for authenticating things like command line usage.

Instead, they accept personal access tokens over HTTPS. Here is a GitHub Docs article about creating a personal access token to use as your password. After entering your personal access token as your password in the command line, the next git push should be good to go.