git报错:git Permission denied, please try again.

1 Problem description:

When git clone/pull code, I am prompted to enter a password. The password is entered correctly but an error is reported: git Permission denied, please try again.

2 solutions:

  • step1 Check whether the SSH Key exists
#cd ~/.ssh
#ls

Insert image description here

  • step2 Get SSH Key

If the id_rsa.pub or id_dsa.pub file exists, skip this step.

If it does not exist, generate:

    • Check the git email address first
#git config --list
    • Regenerate SSH Key
#ssh-keygen -t rsa -C "[email protected]"
  • step3 Copy the public key to the git page profile setting > SSHKeys
#cat ~/.ssh/id_rsa.pub

Copy to SSH Keys page and save

  • step4 Re-execute git clone/pull

Guess you like

Origin blog.csdn.net/qq_41943900/article/details/133297533