如何生成ssh keys
SSH keys are a way to identify trusted computers, without involving passwords。 The steps below will walk you through generating an SSH key and then adding the public key to your GitHub account。
Tip: We recommend that you regularly review your SSH keys list and revoke any that haven‘t been used in a while。
Step 1: Check for SSH keys
First, we need to check for existing SSH keys on your computer。 Open up your Terminal and type:
[plain] view plaincopyls -al ~/。ssh # Lists the files in your 。ssh directory, if they exist
Check the directory listing to see if you already have a public SSH key。 The default public key file names are:
id_dsa。pub
id_ecdsa。pub
id_ed25519。pub
id_rsa。pub
Tip: If you have a new installation of Mac OSX, you will not have a~/。ssh directory。 It will be created when you run the ssh-keygen command instep 2below。
Step 2: Generate a new SSH key
To generate a new SSH key, copy and paste the text below, making sure to substitute in your email address。 The default settings are preferred, so when you’re prompted to “Enter a file in which to save the key”, just pressEnter to continue。