Entering a username and password every time while accessing a remote repository is a very tedious and time-consuming task.
No one wants to do that.
Use the following command to store GitHub/Gitlab credentials for automatic authentication.
git config --global credential.helper store
A credential helper is a helper program that securely stores usernames and passwords used for authentication when interacting with remote Git repositories.
In this case, we are using the “store” helper function and saving the credentials in a plane-text file on the local system.
Run the above command.
When you execute any git command that requires authentication, you will be prompted to provide a username and password.
Suppose you run
You will be asked to enter your username and password. Once you enter the username and password, these credentials will be stored globally on your system.
You can always read the credentials from
Next time you use any git command that requires authentication (like git clone, git push, git pull…) to access your remote repository, these credentials will be used by git automatically.
You don’t need to enter your username and password again.