Git keeps requiring password but none of my password/tokens/passphrase works

Viewed 96

On a linux ubuntu server, I have set up git/github already with ssh key-pair authorization. It was working before last week. However, suddenly when I use git pull or git push, or simply ssh -T git@github.com, a strange password request showed up

>git push
git@github.com's password:
Permission denied, please try again.
...
git@github.com: Permission denied (publickey,password).
ssh -T git@github.com
git@github.com's password:
Permission denied, please try again.
...
git@github.com: Permission denied (publickey,password).

I tried the passphrase used for ssh key-pair, and also tried re-generating ssh key-pair several times and updating them on github. I also tried typing the account password used to log into github.com. I even tried the personal token generated from github.But none of these works.

What could happen to the server that causes the strange issue? Anyone knows how to resolve it?

Thank you!

2 Answers

a strange password request showed up

That means the SSH keys proposed by your local SSH client do not match the public key registered in your GitHub account.

You can see what is used with ssh -Tv git@github.com (as LeGEC suggests in the comments).

Try, for testing, to generate one without passphrase:

ssh-keygen -t rsa -P "" -f ~/.ssh/github
export GIT_SSH_COMMAND="/usr/bin/ssh -o StrictHostKeyChecking=no -i /home/me/.ssh/github"
git clone git@github.com:me/myRepo

When you use ssh protocol repository url, it does not ask for your username and password/token. We've encountered similar issues lately, which are due to ssh config.

If you've configured ssh keys correctly and it still doesn't work, try this.

Edit /etc/ssh/ssh_config and add these lines

Host *
       HostKeyAlgorithms +ssh-rsa
       PubkeyAcceptedAlgorithms +ssh-rsa
Related