How do I make Git remember my credentials?
If you’re accessing your Git repositories over HTTPS protocol you may have noticed that some Git clients keep asking your login and password on each operation. This can be very annoying, especially if you are pushing and pulling a lot of changes throughout the day. While some clients know how to remember your credentials, others need some additional tuning. Continue reading this article to find a solution for your client.
Most GUI clients such as Tower for Mac and Gitbox know how to remember credentials, so you don’t have to do anything. Just enter your username and password once and you will be all set.
Command line Git client will not remember your credentials out of the box. Make sure you are running Git version 220.127.116.11 or higher, then use the following command to enable password caching:
git config --global credential.helper cache
This will make git remember your credentials for 15 minutes after you entered them. To increase that limit use the following command and specify time in seconds:
git config --global credential.helper 'cache --timeout=3600'
For more information about the credential helper refer to the official Git documentation.