In BlogPost, Git

Setting Up Your SSH Configuration File To Work With GitHub

When I first started coding, I didn’t know anything about ssh configuration files. So when I would commit my code to GitHub, I first started out by cloning repositories using an HTTPS based remote.

git-logo_1000x418

This meant I had to enter my GitHub username and password every time I wanted to push and pull. Needless to say, the more code I wrote, the more tedious this became.

So I began looking for a faster way and found the ssh configuration file.

What is an SSH Configuration file?

The SSH configuration file lets your system automatically read options from the config file automatically.

So instead of having to type out something like the below,

you can type something like ssh bruce.

It’s much faster than HTTPS.

Step 1: Set up SSH Configuration

If you’re on a Mac OSX or Linux system, you can simply type:

This creates an empty config file if it doesn’t already exist.

Step 2: Enter the options in your SSH configuration file

Step 3: Generate Public and Private keys

During this step, you will be asked to provide a password. Please pick a strong password when you generate this key.

Step 4: Set up GitHub With Your Private and Public Keys

Copy and paste the results of the cat command above into your GitHub account. You can find some good instructions from GitHub here.

The below screenshot shows where you add your public key output by the cat command.

github_ssh_configuration_keys

Now, when you do a push/pull with GitHub, you’ll only have to enter the password credential you made in Step 3.

Summary

Creating an SSH configuration file to work with GitHub is easy.

  • Setup the SSH configuration file
  • Enter the options in the SSH configuration file
  • Generate public and private keys
  • Enter your public key in GitHub
Recent Posts
elixir logo from github