Git error:[email protected]: Permission denied (publickey).
Complete error message
Error reason
I did a lot of research and decided that there was no SSH public key generated locally (or on the server)
The solution
The first step
When you do not have an SSH public key, enter the following command in Terminal:
Ssh-keygen -t rsa -c "[email protected]" copies the codeCopy the code
Press Enter, and the following figure will appear. Regardless of the questions to be entered, press Enter, and the SSH public key will be generated. (Regenerating will overwrite the previous SSH public key)
The second step
Enter the following command in Terminal:
SSH -v [email protected] Copy the codeCopy the code
The third step
Run the following command in Terminal:
Ssh-agent-s replicates the codeCopy the code
In Terminal, information similar to the following figure is displayed
The fourth step
Run the following command in Terminal:
$ssh-add ~/. SSH /id_rsa Copy codeCopy the code
Note:
Some friends may have problems with the previous step, and the following information is displayed
If you encounter this problem, don’t panic. Type the following command in Terminal:
$eval 'ssh-agent-s' copies the codeCopy the code
Then type again:
$ssh-add ~/. SSH /id_rsa Copy codeCopy the code
As shown, the problem has been solved! Perfect!
Step 5
Based on the SSH public key path information generated in Step 4, find id_rsa.pub, open it in text mode, and copy all the contents in it.
Once the copy is complete, go to your Gitee(code cloud), log in to your account, and follow the following steps to enter the heart:
If your email received the message, the public key was added successfully, and the problem is solved. Im/POST /5e5cc3… Save it for next time.