Skip to content

credential-store Git Command Guide

The git credential-store command provides a credential helper that stores Git credentials in plain text format in the user’s home directory. It’s a simple persistent storage mechanism, but stores credentials unencrypted, so use only on trusted machines.

Terminal window
git credential-store <action>
ActionDescription
getRetrieve credentials for given parameters
storeStore given credentials for future retrieval
eraseRemove stored credentials
OptionDescription
—helpDisplay help information
—file Use specified file instead of default ~/.git-credentials
ParameterDescription
Input from stdin for get/store actions:protocol, host, path, username, password
Terminal window
git config --global credential.helper store

Configures Git to use store helper for all repositories.

Terminal window
echo "protocol=https
host=github.com
username=your-username
password=your-password" | git credential-store store

Saves credentials to ~/.git-credentials file.

Terminal window
echo "protocol=https
host=github.com
username=your-username" | git credential-store get

Outputs stored credentials for given parameters.

Terminal window
echo "protocol=https
host=github.com
username=your-username" | git credential-store erase

Removes credentials from store for specified parameters.

Terminal window
git config --global credential.helper 'store --file ~/.git-private-credentials'

Specifies custom location for credential storage.

To set up Git credential store, use:

Terminal window
git config --global credential.helper store

To view stored credentials, read the file:

Terminal window
cat ~/.git-credentials

To store credentials manually, run:

Terminal window
echo "protocol=https\nhost=example.com\nusername=user\npassword=pass" | git credential-store store

Credential store saves credentials in plain text, making it suitable only for secure, personal environments.

To erase stored credentials, use:

Terminal window
echo "protocol=https\nhost=example.com\nusername=user" | git credential-store erase

Applications of the git credential-store command

Section titled “Applications of the git credential-store command”
  1. Permanent credential storage for personal development machines
  2. Simplifying authentication in trusted development environments
  3. Supporting automation scripts with persistent credentials
  4. Integrating with password management tools for plain text export
  5. Enabling seamless Git workflows on secure workstations
  6. Managing multiple repository credentials across different services