How to fix git push fatal: Authentication failed for Username & Password
git pushUsername for 'https://github.com':
Password for 'https://github.com':
Check GitHub authentication.
ssh -T git@github.com
Problem: password authentication was removed on August 13, 2021. Please use a personal access token instead.
Terminal
% git push Username for ...
Password for ....
remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.
remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information.
fatal: Authentication failed....
Solution: Switch GitHub config to Use SSH
Update the .git/config
to SSH instead of HTTPS.
Before : update the section [remote] url HTTPS link to SSH link
nano .git/config[core]
....
....
[remote "origin"]
url = https://github.com/....
fetch = +refs/heads/*:refs/remotes/origin/*
You can get SSH Link from Github Repo
Terminal
...[remote "origin"]
url = git@github.com:HT-Group/......
fetch = +refs/heads/*:refs/remotes/origin/*
...
So now you can push code to the repo without errors.