Skip to content

Instantly share code, notes, and snippets.

@Justintime50
Last active January 31, 2022 23:15
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Justintime50/80006b89ffc85b66d5ba3af07c6ebc66 to your computer and use it in GitHub Desktop.
Save Justintime50/80006b89ffc85b66d5ba3af07c6ebc66 to your computer and use it in GitHub Desktop.
Run the following commands to generate and copy an SSH key.

Working with SSH Keys

Follow this guide to generate an SSH private/public key pair, retrieve it, or send it to a client machine.

Usage

# 1) Generate an SSH Key
ssh-keygen -t rsa

# 2) Answer the prompt asking where to save the file (hit enter to save to the default location - recommended)
# 3) Provide a password to accompany your SSH key (recommended)

# 4) Copy your public SSH key (use this to paste in your favorite version control software, etc)
pbcopy < ~/.ssh/id_rsa.pub

# 5) Optional: Send that newly generated key to a client device
ssh-copy-id <username>@<host>

Work with the SSH Agent

Tired of typing in your SSH passphrase? Get rid of it!

NOTE: This process will need to be done on each login.

ssh-add

# If you need to specify the SSH location/file, use the following
ssh-add -K ~/.ssh/id_rsa

Reference

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment