GitHub keep asking for username password when git push
git clone
one of my existing repo (with SSH key added in the Github), modified some files and tried to git push
, and it keeps asking for username and password for git push
operation?
git push
Username for 'https://github.com':
Password for 'https://github.com':
GitHub authentication is successful.
ssh -T [email protected]
Hi mkyong! You've successfully authenticated, but GitHub does not provide shell access.
1. Password authentication was removed
Even if we enter the correct username and password, Github still does not allow for pushing because the password authentication was removed on August 13, 2021. Please use a personal access token instead.
% git push
Username for 'https://github.com': [email protected]
Password for 'https://[email protected]@github.com':
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 for 'https://github.com/mkyong/spring-boot/'
2. Use SSH, not HTTPS
The main reason for this problem is mistakenly git clone
the HTTPS URL; we need the SSH URL to use the SSH keys. The solution is to update the .git/config
file, url
value to SSH instead of HTTPS.
2.1 Go to the repo directory, open the file .git/config
.
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true
[remote "origin"]
url = https://github.com/mkyong/spring-boot
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
2.2 Update the url
from HTTPS https://github.com/mkyong/spring-boot
to SSH [email protected]:mkyong/spring-boot.git
.
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true
[remote "origin"]
url = [email protected]:mkyong/spring-boot.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
Done, try git push
again.
my man. you made my day. clear and perfect description. thanks a lot.
Though I have updated URL in to .ssh/config file, Im still facing trouble for push.
ERROR: Repository not found.
fatal: Could not read from remote repository.
This was super helpful and clear, thank you! 🙂
Thanks man you are awesome
Thank you very much!
Great job sir, I was on the verge of giving up on GitHub. This article was really helpful!
Great post! This is not the answer most are giving to this problem. It’s due (for me) to the deprecation of old repo w https url, even when I was using ssh. It failed with no proper error – but U’re idea fixed it.
Thank you so much!
thank you so much!
really helpful! thanks!
This solved my problem. Thanks!
You saved me!!
You saved my nerves, thank you
it keeps saying permission denied when i type .git/config
That was indeed the case, thanks!
Thank you, dude! It worked perfectly!
Thanks for the tip. It solved my problem 🙂
thank you for your helping article.