Languages
[Edit]
EN

Git - save username and password on windows

12 points
Created by:
Indira
499

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 the below sections we can see described two variants:

  • built-in in operating system Windows Credential Manager,
  • git credential store.

1. Windows Credential Manager example

This approach uses Windows Credential 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 the 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 credential store example

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

Simple steps:

  1. run Git Bash,
  2. run following command:
    git config credential.helper store
  3. run following command in the 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

Alternative titles

  1. How do I save git credential under windows?
  2. Git - save username and password with windows
  3. How to safely store git credential under windows?
  4. Windows and git - save username and password
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

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