When I clone git repositories via https, which is best practise according to github, and use git from the command line, git will ask me for my login credentials on every push. That is really annoying, especially because I have a good passsword which I can’t remember. So I always have to go into 1Password and copy that dang thing.

Luckily there is a global git config to cache the credentials for a limited time after I have entered them once. Here is how to do it:

Set git to use the credential memory cache:

git config --global credential.helper cache

Set the cache to timeout after 1 hour

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

The timeout setting is in seconds. I’ve set mine to 4 hours (--timeout=14400).

(You need Git 1.7.10 or newer to use the credential helper.)