Pradeep Pathak

Setup SSH key Github

Generating a new SSH key

  1. Open terminal and paste the text below, substituting in your GitHub email address.
ssh-keygen -t ed25519 -C "your_email@example.com"

When you’re prompted to “Enter a file in which to save the key”, you can press Enter to accept the default file location. Please note that if you created SSH keys previously, ssh-keygen may ask you to rewrite another key, in which case I recommend creating a custom-named SSH key. To do so, type the default file location and replace id_ssh_keyname with your custom key name.

  1. At the prompt, type a secure passphrase.
> Enter passphrase (empty for no passphrase): [Type a passphrase]
> Enter same passphrase again: [Type passphrase again]

Adding your SSH key to the ssh-agent

  1. Start the ssh-agent in the background.
eval "$(ssh-agent -s)"
  1. Add your SSH private key to the ssh-agent. If you created your key with a different name, or if you are adding an existing key that has a different name, replace id_ed25519 in the command with the name of your private key file.
ssh-add ~/.ssh/id_ed25519

Add the SSH key to your account on GitHub.

  1. Copy the SSH public key to your clipboard.
cat ~/.ssh/id_ed25519.pub

Then select and copy the contents of the id_ed25519.pub file to your clipboard

  1. Go to SSH and GPG keys
  2. click New SSH Key
  3. on the next page, paste your SSH key
  4. Click Add SSH Key
  5. If prompted, confirm access to your account on GitHub.