Problem
After enabled 2FA on my GitHub account, I received the following authentication failure while doing a git push
to my branch:

Notice that the error states that support for password authentication was removed on January 13, 2024.
Solution
With 2FA (Two-Factor Authentication) enabled in your GitHub account, you will not be able to push via HTTPS using your account password. Instead you will need to provide your 2FA authentication code.
⚠️
Enabling 2FA on a GitHub account will require the use of a 2FA token to push to the repository.
A simple workaround is to switch from using HTTPS to SSH. You can do this by navigating to the .git/
directory and opening the config
file. The image below displays the following modifications:
- Comment out the HTTPS URL
- Insert the SSH URL
- Insert user section containing name and email

You can retrieve the SSH url from the GitHub repository, as shown below:

Additional Resource: