May 31, 2022

Git asks for password each time I git push”. Solution: caching credentials with git

If you cloned a repository using HTTPS, git will ask for credentials each time you git push”.

You can cache credentials so that you don’t have to enter credentials each time you git push”.

To cache your credentials:

$ git config credential.helper store
$ git push <HTTPS URL of repository>

Git should ask for your username and password:

Username: <USERNAME>
Password: <PASSWORD>

Next time you run git push”, git should not ask for credentials.

By the way, if you are not sure whether you added the remote as HTTPS or SSH, you can check by running:

$ git remote -v

remote” shows you which remote servers you have configured; -v” shows you the URLs that Git has stored.

Please note that your credentials are stored in plain text locally.

git command line

No affiliates, No Google Analytics, No Facebook Pixel. © 2016-2022. Content is licensed under a CC BY-NC-SA 4.0.