How to Cache and Store your Github passwords in Git
If you are using the HTTPS protocol to clone GitHub repositories you would have come across this annoying scenario where you need to enter the password every time you push, pull and fetch.
If you are cloning the GitHub repositories using SSH then you would always authenticate GitHib using the SSH RSA keys instead of username and password.
How to Cache and Store your GitHub Passwords in Git
If you have the Git Version 1.7.10 or above then you can cache and store your GitHub passwords in Git using Git Credential Helper. The credential helper is included with GitHub Desktop. The app also provides a Git shell so you won’t ever need to install and configure Git manually.
If you are working on the command line or Powershell, then you could install native git shell and use the git credential helper command to store the password.
For msysgit 1.8.1 and above wincred helper was added and you can use the below command to configure.
Git Command to Cache and Store your GitHub Passwords in Git
git config --global credential.helper wincred
If you are using the msysgit older than 1.8.1 than you need to first download the git-credentials-winstore and install it to make it work. Make sure that you install this in the Git directory which is provided in the environment path variables. Default directory for 32-bit git would be
C:/Program Files (x86)/Git/cmd and for 64 bit
Once the installation is done then open the command prompt and type the below command
git config --global credential.helper winstore
or you could also edit the .gitconfig manually as shown below.
helper = winstore
Once you have done this you could store the Git credentials through windows credentials manager.
How to Remove Git Credentials from Git using Credentials helper.
Use the below command in Git Bash shell to remove the cached password.
git config --global --unset credential.helper
or you could also edit the .gitconfig manually and remove the lines
helper = !\"C:/Program Files (x86)/GitExtensions/GitCredentialWinStore/git-credential-winstore.exe\"