How to store git HTTPS passwords / credentials permanently so you only have to enter them once

Note: Since 2021, I strongly recommend to use git credential manager core instead of using this older method. See How to install git credential manager core on Ubuntu 20.04

Problem:

Every time you clone a git repository or push/pull, you have to enter a username and a password (e.g. for GitHub or your GitLab installation). Instead, you want git to store the password so you only have to enter it once.

Solution

Configure the git credential helper to use a plaintext store instead of the default cache:

git config --global credential.helper store

NOTE: This approach will store your passwords in a plaintext file, so depending on your setup this might be a security risk.