Generate an SSH key

Key with "Duplication Prohibited" on it

Generating an SSH key

  1. Open Terminal
  2. Generate your key pair using your email address
    $ ssh-keygen -t ed25519 -C "your.email@example.com"
    Generating public/private ed25519 key pair
  3. When prompted to "Enter a file in which to save the key," press Enter to accept the default file location
    $ Enter file in which to save the key (~/.ssh/id_ed25519): ~/.ssh/[id_keyfile]
  4. At the prompt, simply press enter for an empty passphrase
    $ Enter passphrase (empty for no passphrase): [press enter]
    $ Enter same passphrase again: [press enter again]

    Note: You can choose to enter a passphrase, but you will have to enter the password every time you run git commands

  5. After creating the passphrase you'll see the following confirmation
    Your identification has been saved in ~/.ssh/[id_keyfile].
    Your public key has been saved in ~/.ssh/[id_keyfile].pub.

Remove the passphrase for and existing SSH key

  1. Open Terminal
  2. Change the passphrase to an empty one
    $ ssh-keygen -p -f ~/.ssh/[id_keyfile]
  3. At the prompt, enter your old passphrase, then simply press enter for an empty passphrase
    Enter old passphrase: 
    Key has comment 'your.email@example.com'
    Enter new passphrase (empty for no passphrase): 
    Enter same passphrase again: 
    Your identification has been saved with the new passphrase.

Change the comment for an existing SSH key

  1. Open Terminal
  2. Change the comment
    ssh-keygen -c -C "My new comment" -f ~/.ssh/[id_keyfile]
  3. At the prompt, enter your new comment
    Old comment: Old comment
    Comment 'My new commment' applied

     

Tags

Add new comment

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.