Languages
[Edit]
EN

Git - save username and password on windows

12 points
Created by:
Marcin
18490

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:

  1. run Git Bash,
  2. run following command:
    git config --global credential.helper manager
  3. run following command in project directory:
    git pull
    or any other git command that requires authentication,
  4. Windows Credential Manager will ask us for username and password,
  5. type username and password and click Ok or other confirmation action,
  6. all future git authentications for this git account will go from Windows Credential Manager.

Notes:

2. git credintial store example

This approach uses git credintial store that stores passwords in simple text file.

Simple steps:

  1. run Git Bash,
  2. run following command:
    git config credential.helper store
  3. run following command in project directory:
    git pull
    or any other git command that requires authentication,
  4. we will be asked to provide username and password to our git account,
  5. type username and password and click Ok or other confirmation action,
  6. 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.

References

  1. Git Credential Manager for Windows
  2. Windows Credential Manager
  3. Git config - docs

Git

Native Advertising
­čÜÇ
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

ÔŁĄ´ŞĆ­čĺ╗ ­čÖé

Join