View the local ssh public key and generate the public key

View the ssh public key method:
  1. Via the command window
a. Open your git bash window
            b. Enter the .ssh directory: cd ~/.ssh
c. Find the id_rsa.pub file: ls

d. View the public key: cat id_rsa.pub     or vim id_rsa.pub
As shown in the figure:

  2. Or you can enter the command directly: cat ~/.ssh/id_rsa.pub
As shown in the figure:

 3. Or you can directly open the .ssh folder under your user (usually Administrator) and open the id_rsa.pub file in it, as shown in the figure:

What is a public key:
1. Many servers require authentication, and ssh authentication is one of them. Generate the public key on the client side, add the generated public key to the server, and you do not need to enter the username and password every time you connect to the server in the future.
2. Many git servers use ssh authentication. You need to send the public key you generated to the code repository administrator and let him add it to the server for you. You can freely pull and submit code through ssh.


 Generate public key:
1. If the public key cannot be found by the above method, you need to generate the public key first: ssh-keygen
2. Then the address where the public key is stored will be confirmed, the default is the path mentioned above, and the enter key is directly confirmed
3. Then you will be asked to enter a password and confirm the password. If you don't want to set a password, just press enter without entering the content.
As shown in the figure:

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325597378&siteId=291194637