GitLab adds SSH keys and clones the project

[Computer environment]
Mac, git installed

[Add SSH keys]
1. Click Finder > Terminal, enter the terminal and
enter git. If the following prompt appears, it proves that git is installed successfully.
insert image description here
2. Enter ssh-keygen -t rsa -C '[email protected]'

ssh-keygen -t rsa -C '[email protected]'

Customize the mailbox, then press Enter, and these three prompts appear later, you can also directly press Enter

Enter file in which to save the key (/Users/chenyanchun/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 

The appearance of id_rsa and id_rsa.pub proves that the ssh key is successfully generated

insert image description here
3. Open the file and copy the SSH key

vim ~/.ssh/id_rsa.pub

[Clone project]
Enter in the terminalgit clone 项目链接

When using SSH to connect to GitLab for the first time, there will be an RSA password fingerprint confirmation, just enter yes to accept, and the confirmation prompt will not appear after connecting again.

The authenticity of host 'gitlab.com' can't be established.
ECDSA key fingerprint is SHA256:HbW3g8zUjNSksFbqTiUWPWg2Bq1x8xdGUrliXFzSnUw.
Are you sure you want to continue connecting (yes/no/[fingerprint])? 

Guess you like

Origin blog.csdn.net/weixin_46475607/article/details/130089505