Save credentials using git config --global user.name

I don’t want git to ask me for my username (or even my password) every time i push, pull or clone.

Whenever I clone a personal repository i already do https://gihub.com/Username/Repo so it won’t ask me there but if I do

git config --global user.name "Username"

and try to push to that same repository it promts me to enter in anyway.

How do I prevent that?

You can use:

git config --global credential.helper cache

 This command prevent git to ask username and password, not forever but with a default limit to 15 minutes.

To change this limit you can run:

git config --global credential.helper 'cache --timeout=3600'

This move the default limit to 1 hours.

You can find all this information on help.github.

Hope this helps :slightly_smiling_face:  

-Gabriele-

Mark helpful posts with Accept as Solution to help other users locate important info. Don’t forget to give Kudos for great content!

2 Likes

So the user.name has no effect on pushing or pulling? That’s unfortunate but okay.

The link that I gave you said:
“…credential helper to tell Git to remember your GitHub username and password every time it talks to GitHub.”
So I think even username is cached.

2 Likes