Save credentials for Git HTTP/HTTPS auth with credential.helper
Recently I was annoyed by typing in my credentials for Git HTTP/HTTPS auth all the time. On my search for a solution I found the credential.helper. With the git-credential-cache Git will cache your credentials for a defined time period in memory, so you don’t need to re-enter your credentials all the time.
With Git 1.7.9 or later, you can configure the credential.helper like so:
git config --global credential.helper cache
By default the credentials will be cached for 15 minutes. To extend the period of time to cache the credentials a timeout can be defined optionally:
git config --global credential.helper "cache --timeout=3600"
If you don’t like to cache your credentials, but to store them permanently you’ve the following options.
If you’re on a Mac you can use the native Mac OS X keystore:
git config --global credential.helper osxkeychain
If you’re running Windows you can use the Git Credential Manager for Windows by Microsoft. After installation the credential manager will magically work. If not, try:
git config --global credential.helper manager
For Linux users on Gnome the gnome-keyring can be used, though it’s not available by default. To build the Git gnome-keyring helper follow these instructions:
sudo apt install libgnome-keyring-dev
cd /usr/share/doc/git/contrib/credential/gnome-keyring
sudo make
git config --global credential.helper\
/usr/share/doc/git/contrib/credential/gnome-keyring/git-credential-gnome-keyring