Skip to content

Instantly share code, notes, and snippets.

@xanderim
Last active December 18, 2019 19:07
Show Gist options
  • Save xanderim/8453c9e7f591c165fb84cc7bc1845665 to your computer and use it in GitHub Desktop.
Save xanderim/8453c9e7f591c165fb84cc7bc1845665 to your computer and use it in GitHub Desktop.
Generate / Debug SSH key

Generate. For more info https://help.github.com/en/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent

   ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

start the ssh-agent in the background

   eval "$(ssh-agent -s)"

Create if needed and add ~/your_path/.ssh/config

   Host *
     AddKeysToAgent yes
     UseKeychain yes
     IdentityFile ~/your_path/.ssh/id_rsa

Add key

   ssh-add ~/your_path/.ssh/id_rsa    # -K required for macos https://help.github.com/en/articles/error-ssh-add-illegal-option-k
   ```

https://stackoverflow.com/a/4246809

   nano ~/.ssh/config

set path to your key, e.g.

   IdentityFile ~/.ssh/gitHubKey

save and exit

set permissions

   chmod 600 ~/.ssh/config

additionaly you can add host param

   Host github.com
     User git
     IdentityFile ~/.ssh/githubKey
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment