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

Time:05-25

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 [email protected], a strange password request showed up

>git push
[email protected]'s password:
Permission denied, please try again.
...
[email protected]: Permission denied (publickey,password).
ssh -T [email protected]
[email protected]'s password:
Permission denied, please try again.
...
[email protected]: 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!

CodePudding user response:

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 [email protected] (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 [email protected]:me/myRepo

CodePudding user response:

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