How to stop git asking for username and password

In this article let’s discuss about How to stop git asking for username and password. Let’s go through the following methods without any delay.

Method 1:

# it will ask just one more time
git config --global credential.helper store

If you are facing any issues with the above approach then try the alternative that is given below. It may look similar but have a try!

Method 2 :

// For permanently stop git from asking credentials
$ git config credential.helper store
$ git push https://github.com/repo.git

Username for 'https://github.com': 
Password for 'https://USERNAME@github.com': 

// User can also specify caching expire
$ git config --global credential.helper 'cache --timeout 7200'
// After enabling credential caching, it will be cached for 7200 seconds (2 hours).

Hope the above solution works.

Realted Posts : Linux remove last line from file