How To See Your Git Credentials in the Terminal
Managing Git credentials can feel like navigating a hidden layer of your development environment. They're essential — Git needs them to authenticate with remote repositories like GitHub, GitLab, or Bitbucket — but they're rarely front-of-mind until something breaks or you need to verify what's configured. Here's a practical breakdown of where Git credentials live, how to surface them from the terminal, and why the answer varies depending on how your system is set up.
What "Git Credentials" Actually Means
Before diving into commands, it helps to clarify what you're looking for. Git credentials typically refers to two separate things:
- Your identity — the name and email address attached to your commits
- Your authentication credentials — the username and password (or token) Git uses to push and pull from remote repositories
These are stored and accessed differently, which is why there's no single command that reveals everything at once.
Checking Your Git Identity (Name and Email)
Your commit identity is the easiest piece to inspect. Run this in any terminal:
git config --list This outputs all active Git configuration settings. Look for:
user.name=Your Name [email protected] To query a specific value directly:
git config user.name git config user.email Git configuration works in layers — system, global, and local (per-repository). A local config inside a specific repo can override your global settings, which is worth knowing if you see unexpected values.
To check where a setting is coming from:
git config --show-origin user.email This tells you the exact file path of the config file defining that value — useful when something doesn't match what you expect.
Viewing Stored Authentication Credentials 🔐
This is where things get more variable. Git doesn't store passwords in plain config files by default. Instead, it uses a credential helper — a system-level tool that handles storing and retrieving authentication details securely.
To see which credential helper is configured:
git config --global credential.helper Common outputs include:
| Output | What It Means |
|---|---|
osxkeychain | macOS Keychain is managing credentials |
manager or manager-core | Git Credential Manager (Windows/cross-platform) |
store | Credentials saved in a plain text file |
cache | Credentials held temporarily in memory |
| (blank) | No credential helper configured |
Each of these requires a different approach to actually view the stored values.
How To View Credentials by Helper Type
If Using store
The store helper saves credentials in a plain text file — by default at ~/.git-credentials. You can read it directly:
cat ~/.git-credentials Entries look like:
https://username:[email protected] This is the most transparent method, but also the least secure, since credentials sit in an unencrypted file.
If Using osxkeychain (macOS)
Credentials are stored inside the macOS Keychain, not in a file Git controls. To retrieve them from the terminal:
git credential-osxkeychain get Then type the host details when prompted:
protocol=https host=github.com Press Enter twice. If credentials exist, the keychain returns the username and password (or token).
Alternatively, open Keychain Access from Spotlight and search for "github" or the relevant host name to find stored entries visually.
If Using Git Credential Manager (Windows or Cross-Platform)
On Windows, credentials are typically stored in the Windows Credential Manager. You can access it through:
- Control Panel → User Accounts → Credential Manager → Windows Credentials
- Look for entries under "Generic Credentials" prefixed with
git:
From a terminal with Git Credential Manager installed:
git credential-manager get Follow the same prompt format — enter protocol and host — to retrieve stored values.
If Using cache
The cache helper holds credentials in memory for a limited time (default: 15 minutes). There's no way to directly read these values back out — the cache is designed to be write-only from a retrieval standpoint. Once it expires, credentials are cleared automatically.
Checking Remote URLs (Which Account Is Being Used) 🔍
If your question is really "which account am I using for this repo," check the remote URL:
git remote -v This shows the fetch and push URLs for your configured remotes. The username embedded in an HTTPS URL can tell you which account is active for that repository.
The Variables That Change Your Answer
What you'll actually find — and how you'll find it — depends on several factors:
- Operating system — macOS, Windows, and Linux each handle secure credential storage differently
- Git version — newer versions of Git bundle Git Credential Manager; older installations may not
- How Git was installed — via Homebrew, the official installer, a package manager, or as part of Xcode tools each produces slightly different default configurations
- Whether you use HTTPS or SSH — SSH authentication uses key pairs stored separately from Git's credential system entirely; checking those requires inspecting
~/.ssh/and your SSH agent - Repository-level overrides — local
.git/configfiles can point to different remotes or use different credential helpers than your global setup
A developer running Git through WSL on Windows is working in a fundamentally different credential environment than someone on a native macOS installation — even if the terminal commands look identical on the surface.
Understanding which layer your credentials live in is ultimately what determines which command actually surfaces them.