Progress:
TIER 2 · MODULE 47· Intermediate

git credential-store

Writes creds in cleartext. Convenient. Insecure. Know the trade.

🎯 What & why

git credential-store saves credentials in plaintext on disk. It just works, everywhere, and exposes your tokens to anyone who reads the file.

🧠 Mental model

A flat file of https://user:token@host URLs. No encryption. No expiry. If the threat model includes 'someone reads my home directory', this helper is wrong.

🛠️ Synopsis

git config --global credential.helper store
git config --global credential.helper 'store --file=~/.git-creds-work'

# File format (one line each):
# https://alice:ghp_xxx@github.com
# https://bob:token@gitlab.example.com

🎚️ Switches & options

FlagWhat it does
--file=<path>Override the storage file; default ~/.git-credentials then $XDG_CONFIG_HOME/git/credentials
storePlumbing: append a cred to the file
getPlumbing: look up a cred
erasePlumbing: remove matching lines
default permissions⚠️ File is created mode 600 — but plaintext is still plaintext

📦 Subcommands

store — Write a credential line to the file
git credential-store store < cred.txt
get — Look up a credential by description
git credential-store get < desc.txt
erase — Delete matching credential lines
git credential-store erase < desc.txt

💡 Use cases

🧪 Examples

Default file
git config --global credential.helper store
Custom file per context
git -C ~/work config credential.helper 'store --file=~/.git-creds-work'
Inspect what's stored
cat ~/.git-credentials
Wipe everything
rm ~/.git-credentials

🎓 Recommendations

🪤 Common pitfalls

🔗 Related modules

📝 Quiz

Hit each option, then Check answers. Score is recorded; Next is always open.