Since August 13, 2021, GitHub does not accept your account password for Git over HTTPS. If git push or git clone asks for a password and then fails, this is almost always why.
Run gh auth login and follow the prompts. GitHub recommends it, and Git then uses that login over HTTPS.
Create a personal access token on GitHub. When Git asks for a password, paste the token instead of your password.
Switch the remote to SSH with git remote set-url origin git@github.com:OWNER/REPOSITORY.git and add an SSH key to your account.
Git Credential Manager (included with Git for Windows) is the other recommended route. It handles sign-in, including two-factor authentication, and remembers it for you.
you@laptop my-project % git push origin main
Username for 'https://github.com': yourname
Password for 'https://yourname@github.com':
remote: Support for password authentication was removed on August 13, 2021.
fatal: Authentication failed for 'https://github.com/yourname/project.git/'
Older reports show remote: Invalid username or password. followed by the same fatal: Authentication failed line. Both mean GitHub did not accept what you typed. The exact wording can differ by Git version, so match on Authentication failed. I could not reproduce these lines on my machine, because they need a real GitHub login. They are quoted from public reports and GitHub's own docs, linked below.
GitHub's docs say it plainly: the next time you git fetch, git pull or git push, you are asked for your username and password. When Git asks for the password, enter your personal access token. Create one in your GitHub settings under Developer settings. Give it only the access you need, and set an expiry. Treat it like a password: never paste it into a repository or a chat.
Without a credential helper you would have to paste the token on every push. Use gh auth login or Git Credential Manager so it is stored securely and you stop retyping it.
If you saved the old password earlier, Git keeps sending it and keeps failing, without asking again. GitHub's docs say to open Credential Manager in the Windows Control Panel, find the GitHub entry and delete it. Git then prompts you fresh.
git remote -v shows your remote URL. A URL starting with https:// uses the token or login route above. A URL starting with git@github.com: uses SSH keys, and its failures look different because they are about keys, not passwords. To change a remote between the two, use git remote set-url origin NEW-URL.
GitHub changelog: Git password authentication is shutting down
GitHub Docs: Caching your GitHub credentials in Git
GitHub Docs: Managing remote repositories
GitHub stopped accepting account passwords for Git over HTTPS on August 13, 2021. Use a personal access token as the password, GitHub CLI, Git Credential Manager, or an SSH remote.
Your personal access token, created in GitHub settings, not your account password.
Run gh auth login or use Git Credential Manager so the login is stored securely.
Old credentials are cached. On Windows, delete the GitHub entry in Credential Manager so Git prompts again.