The first step to enter the company (configure ssh public key to pull the company project)-view the local ssh public key, generate the public key, configure the ssh public key

  • Enter the company's project boss and directly give you a document with many projects, giving you time to familiarize yourself with the project. Then the first step is to pull the project from git or Alibaba Cloud repository (there may be other repositories, but they never change).
  • But many friends can't pull it down for a long time, but they don't know that they have not taken the first step: configuring the ssh public key.
  • Many small partners have a question about what the public key is and what is it used. Here is an explanation of the public key:
 1.很多代码服务器都是需要认证的,ssh认证是其中的一种。在客户端生成公钥,把生成的公钥添加到代码服务器,你以后连接服务器拉取代码时就不用每次都输入用户名和密码了。
 2.很多git服务器都是用ssh认证方式,你需要把你生成的公钥发送给代码仓库管理员,让他给你添加到服务器上,你就可以通过ssh自由地拉取和提交代码了。
 3.如果是github、码云、coding、华为云开发者,你把公钥加到自己个人中心的SSH公钥列表里即可  
  • Configure the ssh public key then we must first get the ssh public key,

Case 1: The computer has an ssh public key

  • First see if the computer you are using has an ssh public key
  • View the local ssh public key to install git
  • Open your git bash window
 cd ~/.ssh  //进入.ssh目录
ls  //查看当前文件夹文件
cat id_rsa.pub    或者 vim id_rsa.pub  //查看公钥
 cat ~/.ssh/id_rsa.pub //还可以直接一步到胃  你懂得

The SSH public key is obtained in the above steps
Insert picture description here

Situation 2: The computer does not have a public key

  • Why don't you have a public key? Of course it is to create a public key
ssh-keygen -t rsa -C "[email protected](你的邮箱)"  #-C注释为了区分秘钥,也可以不写
 
# Generating public/private rsa key pair...
# 三次回车即可生成 ssh key
  • Add it to the warehouse when you have it
  • Find the ssh public key in the warehouse settings
  • Insert picture description here
    In this way, the code can be pulled comfortably, and there is no need to enter the password account in the future.

Guess you like

Origin blog.csdn.net/weixin_45528650/article/details/109742859