Store git credentials for remote servers
You’re taking a CS course at UBC and have just finished a chunk of work that you want to commit.
When you try to git push or git pull, you’re asked to type in your CS department’s username and password:

This guide will show you how to use git config to cache your authentication info.
Saving credentials
Git has this nice feature called credentials that lets you store authentication credentials for git servers (like stash.ugrad.cs.ubc.ca for UBC).
We’ll be using the cache option, which will store the credentials temporarily.
Run the following command to enable this git option:
# 10368000 is 4 months in seconds
# With this config, git will remove credentials from memory after 4 months
git config --global credential.helper 'cache --timeout=10368000'
You can check that this config is enabled by running the following command:
# Should return output like this:
# [credential]
# helper = cache --timeout=10368000
cat ~/.gitconfig
Saving credentials permanently
If you want to save the password permanently on the system, you can use the store option with the following command:
git config --global credential.helper store
However, note that once you type credentials for a git server, the credentials will be stored in the ~/.git-credentials file as plain text!
Hope this helps!