02 February 2016

git is much more convenient if you create a ssh key for use when accessing your repository.

First, do you have a ~/.ssh directory? No? Then:

$ mkdir ~/.ssh
$ chmod 700 ~/.ssh

Do you have xclip installed? No, then:

$ sudo apt-get install xclip

Okay, lets generate the public and private keys for github.

$ ssh-keygen -t rsa -b 4096 -C dennis@bipedalprogrammer.com

When prompted for a file name I used: /home/dennis/.ssh/id_rsa_github

Give it a passphrase for additional security.

Now start the ssh-agent to manage your keys.

$ eval "$(ssh-agent -s)"

Add your new key to the agent.

$ ssh-add ~/.ssh/id_rsa_github

Then copy your public key to the clipboard.

$ xclip -sel clip < ~/.ssh/id_rsa_github.pub

Now log into github and go to your settings, add an SSH Key. Give it name relative to the current computer and paste your public key into the space provided.

If you have previously cloned a project, you will have to update your remote. Otherwise, get you ssh URL from GitHub and clone your project. You will have to enter your passphrase the first time.