Generating an SSH key
- Open Terminal
- Generate your key pair using your email address
$ ssh-keygen -t ed25519 -C "your.email@example.com" Generating public/private ed25519 key pair
- 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]
- 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
- 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
- Open Terminal
- Change the passphrase to an empty one
$ ssh-keygen -p -f ~/.ssh/[id_keyfile]
- 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
- Open Terminal
- Change the comment
ssh-keygen -c -C "My new comment" -f ~/.ssh/[id_keyfile]
- At the prompt, enter your new comment
Old comment: Old comment Comment 'My new commment' applied
Add new comment