Skip to content

Instantly share code, notes, and snippets.

@marioblas
Last active March 29, 2016 18:58
Show Gist options
  • Save marioblas/cf7a87e86105f8d5b735 to your computer and use it in GitHub Desktop.
Save marioblas/cf7a87e86105f8d5b735 to your computer and use it in GitHub Desktop.
🔐 Generating SSH keys
# References:
# https://help.github.com/articles/generating-ssh-keys/
# https://help.github.com/articles/working-with-ssh-key-passphrases/
###############################################################################
# 1. Check for SSH keys
###############################################################################
# List the files in your .ssh directory, if they exist
ls -al ~/.ssh
###############################################################################
# 2. Generate a new SSH key
###############################################################################
# Create a new ssh key, using the provided email as a label
ssh-keygen -t rsa -C "your_email@example.com"
# Then add your new key to the ssh-agent:
# start the ssh-agent in the background
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa
###############################################################################
# 3. Add your SSH key to your account
###############################################################################
# Copy the contents of the id_rsa.pub file to your clipboard
pbcopy < ~/.ssh/id_rsa.pub
# Add to your Github account for example
# Settings → SSH keys → Add SSH key → Add a label & paste your key → Add key
###############################################################################
# 4. Test everything out
###############################################################################
# Attempts to SHH to GitHub
# Answer → yes
ssh -T git@github.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment