SSH to Github

Access Github without passwords

SSH to Github

by John Vincent


Posted on April 28, 2018



Configure Ubuntu SSH

Basic configuration so let’s begin.

Configure SSH Keys

Login to Ubuntu system

Start SSH-Agent

eval "$(ssh-agent)"

Generate a new key, do not enter a passphrase

cd .ssh
ssh-keygen -t rsa -b 4096 -C “github_email_address” -f id_github
passphrase: <none>

This generates two files

  • private: id_github
  • public: id_github.pub

Set permissions

chmod 600 id_github*

Add to keychain

ssh-add -k ~/.ssh/id_github

Verify

ssh-add -l

Add public key to Github account

Copy content of id_github.pub

Login to Github account

  • Settings
  • SSH and GPG keys
  • New SSH key
  • Title: use a descriptive term
  • Paste to SSH key
  • Save

Test SSH Keys

Clone a public and a private repository from your Github account.

For example

git clone git@github.com:<your-github-id>/<your-repo>

Other

Notice this does not permanently add the ssh keys as I am only interested in pulling from Github for a redeployment. The deployment script has the following code

eval "$(ssh-agent)"
ssh-add -k ~/.ssh/id_github

which enables the git clone.