Problem Description
When using SSH to connect to Github: git clone [email protected]:xxxxxxxx
The following error occurred:
Check existing SSH keys
Open the terminal and enter ls -al ~/.ssh
:
There are three types of SSH public key file names by default:
- id_rsa.pub
- id_ecdsa.pub
- id_ed25519.pub
Here I already have an SSH key (id_rsa.pub), if not, I need to generate a new SSH key .
Configure Github
Copy the public key
Terminal input: pbcopy < ~/.ssh/id_rsa.pub
(XX.pub corresponds to your public key type). If pbcopy does not work, you can find the hidden .ssh folder in the corresponding directory, open the file with a text editor, and copy it to the clipboard.
Add public key
Click on the avatar in Github - Settings - SSH and GPG keys - New SSH key
Paste the content you just copied into the Key, and pick up the title:
After that, a confirmation password will pop up:
Test SSH connection
Type in the terminal ssh -T [email protected]
:
Use SSH to connect to Github
Now you can successfully use git clone
the