EN
Git - save username and password on windows
9
points
In this article we want to show how to save username and password for git under Windows, when we don't want to type it each time during push
/ pull
operations.
Quick solution (run command):
git config --global credential.helper manager
In below sections we can see described two variants:
- built-in in operating system Windows Credential Manager,
- git credintial store.
1. Windows Credential Manager example
This approach uses Windows Credintial Manager that stores passwords in operating system safe storage.
Simple steps:
- run Git Bash,
- run following command:
git config --global credential.helper manager
- run following command in project directory:
or any other git command that requires authentication,git pull
- Windows Credential Manager will ask us for username and password,
- type username and password and click Ok or other confirmation action,
- all future git authentications for this git account will go from Windows Credential Manager.
Notes:
- now our password is saved with Windows Credential Manager - not as plain text
- Available from Git for Windows 2.7.3+ - github release
2. git credintial store example
This approach uses git credintial store that stores passwords in simple text file.
Simple steps:
- run Git Bash,
- run following command:
git config credential.helper store
- run following command in project directory:
or any other git command that requires authentication,git pull
- we will be asked to provide username and password to our git account,
- type username and password and click Ok or other confirmation action,
- all future git authentications for this git account will go from
.git-credentials
file.
Note: the password is stored as plain text in
C:\Users\my_user_name\.git-credentials
what is not safe when our account is not encrypted.