How to change to using SSH over HTTP Authentication for GitHub

If you use GitHub and get sick of using your password for authentication, there is another way to push to your remotes; SSH!

The process is as follows;

  1. Find or generate your SSH key
  2. Copy your public key to the GitHub web interface under Settings > SSH & GPG Keys
  3. Remove or add your old git remote
  4. Push without passwords :D

In depth steps

Find or generate your SSH Key

Most people save their keys into a hidden folder in their home directory called .ssh

To see if you’ve got any keys in there, run the command ls ~/.ssh to list out the files you’ve got in that folder.

If you don’t see any files or an error saying the folder doesn’t exist you need to generate a key. This is made easy through a tool called ssh-keygen.

Type in ssh-keygen and follow the steps to generate your own private key pair.

Copy your public key to the GitHub web interface under Settings > SSH & GPG Keys

Now you need to make GitHub aware of that SSH key. To do so go to the site in your browser, click your user profile and go to Settings.

  1. Under settings you can click the SSH & GPG keys section. Click “New SSH Key”
  2. Open your terminal and enter cat ~/.ssh/ or whatever you called you keypair.


You don’t want a copy of your public key on the internet. Guard it like you would guard your password, that means don’t upload it anywhere public!

  1. Save the key

    Remove or add your old git remote

    Time to start using the SSH method to push your code.

If you have an existing codebase you want to use, you might need to remove the HTTP git remote url. To do that open your terminal and;

  1. cd to your codebase
  2. git remote -v
  3. If nothing comes out at this point you are fine, else;
  4. git remote remove origin
  5. Now to add the SSH url;
  6. git remote add origin <SSH_URL> (You will find this in GitHub by clicking “Clone or Download” then “Use SSH”

Push without passwords :D

Now you’ve added the SSH URL you can push your codebase to your remote the way you normally would (git push origin HEAD)

And that’s it!

If you see any mistakes or want any explanations of the topic of this post, get me on Twitter @afallon02 or email me at