Welcome to Shaun Luttin's public notebook. It contains rough, practical notes. The guiding idea is that, despite what marketing tells us, there are no experts at anything. Sharing our half-baked ideas helps everyone. We're all just muddling thru. Find out more about our work at bigfont.ca.

Generate a new SSH Key and add it to GitHub with OpenBSD and PowerShell

Tags: ssh, git, powershell, freebsd

First Steps, in PowerShell (or another shell)

Generate a new SSH key, of type RSA, with your email as a comment

ssh-keygen -t rsa -C "youremail@example.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/TheUser/.ssh/id_rsa): [Just press enter]
Enter passphrase (empty for no passphrase): [Type a passphrase]
Enter same passphrase again: [Type passphrase again]

Add the new key to the SSH Agent

ssh-agent -s 
ssh-add ~/.ssh/id_rsa 

Copy the public key to the clipboard (with PowerShell on Windows 8)

gc id_rsa.pub | clip.exe

Next Steps, in FireFox (or another browser)

  • Once you've copied the public key to the clipboard, it's time to add it to GitHub.
  • GitHub > Settings > SSH keys > Add SSH Key > Paste.
  • Be sure to give the key a descriptive name such as "PowerShell - BIGLEY"

Final step, in PowerShell

Attempt to ssh to github

ssh -T git@github.com

See also