Cache Username and Password

You may have noticed that it seems a little tedious entering username and password every time you tell the git command to talk to GitHub.

One solution here is to configure Git to cache these credentials:

Download: file
git config --global credential.helper cache
git config --global credential.helper 'cache --timeout=3600'

Generate an SSH Key

An even better idea is to generate an SSH key and add it to your account on GitHub. This will enable you to clone repositories from paths like so:

Download: file
[email protected]:username/repo.git

Instead of:

Download: file

...and is almost certain to be more secure than authenticating with a password.

There's a nice GitHub guide on generating SSH keys, and their recommendations are, for the most part, fairly sound. Be aware that you'll probably need to change repositories you've already cloned to use the SSH URL in order to take advantage of this.

GitHub documentation repeatedly recommends use of HTTPS URLs over SSH. This is very likely just because the HTTPS approach is less work for users and easier to explain.

This guide was first published on Jul 15, 2015. It was last updated on Jul 15, 2015.

This page (HTTPS Credential Caching and SSH Keys) was last updated on Apr 08, 2021.

Text editor powered by tinymce.