If you are using password-based authentication to authenticate yourself to the Git server, it might prompt you to enter your password every time you execute git
commands. To avoid that you can configure Git
to cache your credential.
In the local Git repository, open .git/config
file in a text editor and add the following lines to the end of the file. This configuration will be applied to the current repo only. To apply it globally for all repositories in the local machine, add this configuration to <user.home.dir>/.gitconfig
.
[credential] helper = store
Instead of using a text editor, you may also use git
command to do the above configuration:
# Execute the following from a git repo directory, for global configuration git config --global credential.helper store # Execute the following from a git repo directory, applicable to that repo only git config credential.helper store
How To Cache Git Credentials
Be The First
Join our list to get instant access to new articles and weekly newsletter.
[…] Refer to this article on how to cache git credentials. […]