[Windows] Git configure SSH-Key

Check if there is local public

Execute the following statement to determine whether there is a local public key
cat ~/.ssh/id_rsa.pub
if the following screenshot appears, the local public key is not present, proceed step by step.

If you see a long list with ssh-rsa string or the beginning of the ssh-dsa, the local public key already exists, skip ahead to the third step.

How to generate local public

Execute the following statement to generate a local public key
ssh-keygen -t rsa -C "[email protected]"
of this directive will ask you to provide a file name and location to store key-value pairs and password, you can always press Enter to use the default.

Tip 1: In the best case a password corresponding to a ssh key, but is not obliged to do so, create a password like above we skip this step.
Tip 2: Set a password can not be changed, nor can be acquired.

At this point you follow the route C: /Users/Admin/.ssh, find the folder, as shown in FIG.

How to copy local public key

  1. Use Notepad to open id_rsa.pub file, copy it directly to select all the contents.
  2. Depending on the operating system, select a different command.
    Windows clip < ~/.ssh/id_rsa.pub
    mac pbcopy < ~/.ssh/id_rsa.pub
    After executing the command, then the public key has been copied to the clipboard.

Add the local public key to the remote key management

  1. github add SSH: Click on your own avatar upper right corner, choose Settings, click the SSH and GPG keys, click New SSH key, you can add SSH.
  2. Ali cloud add SSH: the project home page, click Settings → SSH public key SSH keys → → increase local public key to copy the "public key" box → Enter a title (required, you can set the home or company logo, etc.) → Finally, click "Add key" button.
    Specific steps as shown below:
    Click SSH public key SSH interface increases, as shown below

    adding new key, as shown

    results as shown, the distal end of the key successfully added, this time can be a conventional the distal end of the push and pull content

Guess you like

Origin www.cnblogs.com/quartz/p/12052109.html