How To Stop Git From Asking Username And Password

When I started to use Git, I always found it frustrating that it kept asking me to enter my credentials every time I wanted to push to a remote repository. After some search, I found a way for it to remember my credentials for a period of time.

The file you need to edit is called .gitconfig which should be in your home directory. Paste the following:

[credential]
	helper = cache --timeout=900000

This will remember your credentials for approximately 10 days so you won’t have to constantly enter your username and password. You can change this value to whatever you want but it must be in seconds.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.