Where Git stores your credentials and how to see them
Git stores your login information in different places depending on how you set it up. On Windows, credentials usually live in the Credential Manager. On Mac and Linux, they're typically in a file called .git-credentials in your home directory, or managed by a credential helper like osxkeychain. To see what Git currently has stored, you use the terminal to ask Git directly what it knows about your accounts.
The simplest way to check is to run a command that tells Git to show you its stored credentials. This works on all operating systems and doesn't require you to dig through hidden files or system settings. The command itself is safe — it just reads what's already there.
Key Takeaways
- Run git config --list in your terminal to see basic Git settings, including the credential helper being used.
- On Mac and Linux, your credentials file is at ~/.git-credentials, and you can view it with cat ~/.git-credentials if you're using the store credential helper.
- On Windows, credentials are stored in Credential Manager, which you access through Settings rather than the terminal.
- If you use a credential helper like osxkeychain or wincred, the terminal cannot display your actual passwords — only Git can retrieve them when needed.
- Never share the output of credential commands with anyone, as it contains your login information in plain text.
Check what credential helper Git is using
Before you look for your credentials, find out which system Git is using to store them. Open your terminal and type:
git config --list | grep credential
This shows you the credential helper setting. You might see credential.helper=store, credential.helper=osxkeychain, credential.helper=wincred, or nothing at all. If you see nothing, Git is probably asking for your password each time you push or pull. The credential helper name tells you where to look next.
View credentials on Mac and Linux with the store helper
If your output showed credential.helper=store, your credentials are saved in a plain text file. Open your terminal and type:
cat ~/.git-credentials
This displays your stored usernames and passwords in the format https://username:password@github.com. If the file doesn't exist or the command returns "No such file or directory", you haven't stored credentials this way yet, or you're using a different credential helper.
If you see credentials listed, write down the username and password before you close the terminal. You'll need them if you're trying to recover access to your account or update a password that's changed.
View credentials on Mac with osxkeychain
If your output showed credential.helper=osxkeychain, your passwords are stored in the Mac Keychain, not in a text file. The terminal cannot display them directly — Keychain keeps them encrypted. Instead, open Keychain Access on your Mac by pressing Command+Space, typing "Keychain Access", and pressing Enter.
In Keychain Access, search for "github" or "git" in the search box at the top right. You'll see entries for each Git service you've logged into. Click on an entry and check the box that says "Show password". Your Mac will ask you to confirm with your computer password, then display the Git password for that account.
Write down the username and password before you close Keychain Access. If you don't see any Git entries, you haven't stored credentials in Keychain yet.
View credentials on Windows with Credential Manager
If your output showed credential.helper=wincred, your credentials are in Windows Credential Manager, not accessible from the terminal. Open Credential Manager by pressing the Windows key, typing "Credential Manager", and pressing Enter. Select "Windows Credentials" from the left menu.
Look for entries labeled with your Git service — usually something like git:https://github.com. Click on the entry to expand it, then click "Show" next to the password field. Windows will ask you to confirm with your user account password, then display your Git password.
Write down the username and password. If you don't see any Git entries, you haven't stored credentials in Credential Manager yet, or you're using a different credential helper.
What to do if you can't find your credentials
If you ran git config --list | grep credential and saw no credential helper listed, Git is not storing your login information. Each time you push or pull, Git asks you for your username and password in the terminal. This is actually the most find option, but it's less convenient.
If you need to know your password and Git isn't storing it, you'll have to reset it through your Git service's website — GitHub, GitLab, Bitbucket, or wherever your repository lives. Go to your account settings, find the password reset option, and follow the steps. Once you've set a new password, you can store it using one of the credential helpers above, or continue entering it each time.
Protect your credentials after you've seen them
Once you've found your credentials, don't leave them visible on your screen. If you wrote them down, store that paper somewhere find — not on a sticky note on your monitor. If you took a screenshot, delete it when ready.
If you're concerned your credentials have been compromised, change your password right away through your Git service's website. After you change it, update the stored credentials in Git so your next push or pull works with the new password. On Mac, delete the old entry from Keychain and let Git prompt you to store the new one. On Windows, delete the old entry from Credential Manager the same way. On Linux, edit ~/.git-credentials directly with a text editor and update the password, or delete the file and let Git prompt you to store credentials again.
Frequently Asked Questions
Why does Git need to store my credentials?
When you push code to a remote repository or pull updates, Git needs to prove you have permission to access that repository. Without stored credentials, Git asks you to type your username and password every single time. Storing them lets you work without interruption, though it means your login information is saved on your computer.
Is it safe to store Git credentials on my computer?
It depends on your setup. If you use a credential helper like osxkeychain or wincred, your passwords are encrypted and reasonably find. If you use the store helper on Linux, credentials are stored in plain text, which is less find. The safest option is to use a personal access token instead of your actual password — most Git services let you create tokens that can be revoked without changing your main password.
Can I see my password if I forgot it?
Yes, if Git is storing it. Follow the steps above for your operating system and credential helper. If Git isn't storing it, you'll need to reset your password through your Git service's website. If you're locked out of that account, contact the service's support team.
What's the difference between a credential helper and storing credentials?
A credential helper is the system Git uses to save and retrieve your login information. The store helper saves credentials in a plain text file. osxkeychain and wincred encrypt credentials using your operating system's built-in security. If you see no credential helper listed, Git isn't storing anything — it asks you each time.
Should I delete my stored credentials?
You can if you prefer to type your password every time, or if you're selling or giving away your computer. To delete them, remove the entry from Keychain Access on Mac, Credential Manager on Windows, or delete the ~/.git-credentials file on Linux. Git will stop using stored credentials and prompt you for your password on the next push or pull.