当前位置:网站首页>Create SSH key pair configuration steps

Create SSH key pair configuration steps

2022-06-26 05:09:00 Light ink CGZ

establish SSH Secret key pair

effect

Created SSH Secret key pair , be used for GitLab Warehouse pull code , And test the login authentication of the server .

Check if the secret key pair exists

It's generating SSH Before the key , You can check , Does it already exist SSH secret key . Here are two ways :

  1. The input terminal ls -al ~/.ssh  Check to see if there are existing SSH secret key :
#  List  ssh  Under the table of contents  .ssh  file   View on terminal 
$ ls -al ~/.ssh
  1. The input terminal cat ~/.ssh/id_rsa.pub You can output the contents of the public key

image.png

  1. stay Finder Interface view . Enter the command to open automatically Finder, You can view it
# open Command to open  ssh  Secret key pair , Hide storage directory  .ssh
$ open ~/.ssh

By default , The file name of the public key is id_rsa.pub

Generate a new SSH Secret key pair

  1. Open the terminal .
  2. The terminal enters the following command , Put the mailbox  ** Replace with yourself  ** Corporate email .
$ ssh-keygen -t rsa -b 4096 -C "[email protected]"

This will use your own corporate email as an identifier , Create a new ssh secret key .
Be careful : If the same directory already exists , It will cover the previous , If you continue to use , Pay attention to backup .

Generating public/private rsa key pair.
  1. When the system prompts “ Enter the file where you want to save the key ” when , press return . Use the secret key to store the location . The default is /Users/ user /.ssh/id_rsa .
Enter a file in which to save the key (/Users/you/.ssh/id_rsa): [Press enter]
  1. Next, you will be prompted for the password . The password is not configured for the time being , Ignore tips , Press enter twice in succession , Complete key pair creation .
Enter passphrase (empty for no passphrase): [Type a passphrase]
Enter same passphrase again: [Type passphrase again]

Reference resources :
GitHub Official generation SSH
GitLab Official document generation SSH

原网站

版权声明
本文为[Light ink CGZ]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/177/202206260505080530.html