How to fix git push fatal: Authentication failed for Username & Password

Kobe
1 min readAug 22, 2022
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.

--

--

Kobe
Kobe

Written by Kobe

I’m working at KMS-Technology company. I love code (▀̿Ĺ̯▀̿ ̿) — Full Stack Software Engineer

No responses yet