This error occurs when Git Credential Manager (GCM) cannot retrieve stored credentials from Windows Credential Manager. Common causes include corrupted credential entries, misconfigured credential stores, or stale authentication tokens that need to be refreshed.
When you see "fatal: credential-manager get: failed to get credentials", Git is telling you that it invoked Git Credential Manager to retrieve your stored authentication credentials, but GCM was unable to fetch them from the underlying credential store. Git Credential Manager (GCM) is a helper application that securely stores and retrieves credentials for HTTPS-based Git operations. On Windows, GCM typically stores credentials in Windows Credential Manager (the system's built-in credential vault). When you push, pull, or fetch from a remote repository, Git asks GCM for credentials. If GCM cannot find them or encounters an error accessing the credential store, it reports this failure. This error is distinct from authentication failures at the server level. Here, the problem is local: GCM cannot even retrieve the credentials to send to the server. The credentials may have been deleted, corrupted, or the credential store configuration may be pointing to a store that doesn't exist or isn't accessible.
The most common fix is to remove stale credentials and let Git prompt for new ones:
Using Windows Settings:
1. Press Windows + I to open Settings
2. Search for "Credential Manager" or go to Control Panel > User Accounts > Credential Manager
3. Click on Windows Credentials
4. Look for entries starting with git: (e.g., git:https://github.com)
5. Click each Git-related entry and select Remove
6. Also check for entries starting with ada: or containing your Git hosting provider
Using Command Line:
# List credentials (PowerShell)
cmdkey /list | findstr git
# Delete a specific credential
cmdkey /delete:git:https://github.com
cmdkey /delete:git:https://dev.azure.com
# Delete all Git credentials
cmdkey /delete:LegacyGeneric:target=git:https://github.comAfter removing the credentials, run your Git command again. You'll be prompted to authenticate, and new credentials will be stored.
Ensure Git is configured to use the correct credential helper:
# Check current credential helper configuration
git config --list --show-origin | grep credential
# Set the credential helper to 'manager' (Git 2.39+)
git config --global credential.helper manager
# For older Git versions, use 'manager-core'
git config --global credential.helper manager-core
# If you have conflicting settings, replace all of them
git config --global credential.helper manager --replace-allIf using Azure DevOps:
git config --global credential.https://dev.azure.com.useHttpPath trueVerify the helper is working:
git credential-manager --version
# Should output something like: Git Credential Manager version 2.x.xIf the default credential store isn't working, try switching to the DPAPI store which stores credentials in encrypted files:
# Configure GCM to use DPAPI store
git config --global credential.credentialStore dpapi
# Verify the setting
git config --global credential.credentialStoreThe DPAPI store encrypts credentials using Windows Data Protection API and saves them to %USERPROFILE%\.gcm\dpapi_store. This can be more reliable than Windows Credential Manager in some environments.
Other available stores on Windows:
- wincredman - Windows Credential Manager (default)
- dpapi - DPAPI-encrypted files
- cache - In-memory cache (credentials lost on restart)
- plaintext - Plain text file (not recommended for security reasons)
# To switch back to Windows Credential Manager
git config --global credential.credentialStore wincredmanForce Git Credential Manager to perform a fresh authentication:
For GitHub:
# Trigger GitHub OAuth login flow
git credential-manager github login
# Or erase existing credentials and re-auth
echo "protocol=https
host=github.com" | git credential-manager erase
# Then run a Git operation to trigger new login
git fetch originFor Azure DevOps:
echo "protocol=https
host=dev.azure.com" | git credential-manager erase
git fetch originFor GitLab:
echo "protocol=https
host=gitlab.com" | git credential-manager erase
git fetch originWhen prompted, authenticate with your browser. For GitHub, you may need to:
1. Click "Authorize" in the browser popup
2. Enter your GitHub password or confirm with 2FA
3. Return to the terminal where Git should complete successfully
If OAuth authentication isn't working, use a Personal Access Token (PAT):
GitHub:
1. Go to [github.com/settings/tokens](https://github.com/settings/tokens)
2. Click Generate new token (classic)
3. Give it a descriptive name and expiration
4. Select scopes: repo (full control) at minimum
5. Click Generate token and copy it immediately
Azure DevOps:
1. Go to your organization's User Settings > Personal Access Tokens
2. Click New Token
3. Set scope to Code (Read & Write)
4. Create and copy the token
Store the PAT manually:
# Clear old credentials first
echo "protocol=https
host=github.com" | git credential-manager erase
# Store new credentials
git credential-manager store <<EOF
protocol=https
host=github.com
username=your-username
password=ghp_yourPersonalAccessToken
EOFOr simply run git push and enter your username and PAT when prompted.
If the credential manager itself is corrupted, reinstall it:
# Uninstall GCM
git credential-manager uninstall
# Reinstall GCM
git credential-manager install
# Verify installation
git credential-manager --versionIf that doesn't work, reinstall Git for Windows:
1. Download the latest Git for Windows from [git-scm.com](https://git-scm.com/download/win)
2. Run the installer
3. When asked about the credential helper, select Git Credential Manager
4. Complete the installation
For Visual Studio users:
1. Open Visual Studio Installer
2. Click Modify on your Visual Studio installation
3. Go to Individual Components
4. Ensure Git for Windows is checked
5. Click Update
This ensures Visual Studio uses a compatible version of Git and GCM.
Multiple credential helper configurations can cause conflicts:
# Show all credential settings from all config levels
git config --list --show-origin | grep credential
# Check for helpers at each level
git config --system credential.helper
git config --global credential.helper
git config --local credential.helperIf you see multiple or conflicting entries:
# Clear all credential helper settings
git config --system --unset-all credential.helper
git config --global --unset-all credential.helper
git config --local --unset-all credential.helper
# Set only the global one
git config --global credential.helper managerCheck for legacy helper names:
If you see manager-core (older) or wincred (very old), update to manager:
git config --global credential.helper managerWindows config file locations to check:
- System: C:\Program Files\Git\etc\gitconfig
- Global: %USERPROFILE%\.gitconfig
- Local: .git\config in each repository
Enable tracing to understand what's happening:
# Enable GCM debug logging
set GCM_TRACE=1
set GIT_TRACE=1
# Run the failing command
git fetch origin
# View detailed output showing credential manager operationsTest credential manager directly:
# Test credential retrieval
echo protocol=https
host=github.com | git credential-manager get
# Should output stored credentials or prompt for new ones
# If it errors here, the issue is with GCM configurationCheck GCM logs:
# GCM can write logs to a file
set GCM_TRACE=%USERPROFILE%\gcm.log
git fetch origin
type %USERPROFILE%\gcm.logThe log will show exactly where in the credential retrieval process the failure occurs.
If HTTPS credential issues persist, switch to SSH authentication:
# Check if you have an SSH key
ls ~/.ssh/id_ed25519.pub
# or
ls ~/.ssh/id_rsa.pub
# If not, generate one
ssh-keygen -t ed25519 -C "[email protected]"Add your SSH key to GitHub:
1. Copy your public key: clip < ~/.ssh/id_ed25519.pub
2. Go to GitHub.com > Settings > SSH and GPG keys
3. Click New SSH key and paste your key
Change your remote from HTTPS to SSH:
# View current remote
git remote -v
# origin https://github.com/user/repo.git (fetch)
# Change to SSH
git remote set-url origin [email protected]:user/repo.git
# Verify the change
git remote -v
# origin [email protected]:user/repo.git (fetch)
# Test the connection
ssh -T [email protected]SSH uses key-based authentication instead of passwords, completely bypassing credential manager issues.
### Understanding Git Credential Manager Stores
GCM supports multiple credential stores. On Windows, the default is Windows Credential Manager, but issues with it can be resolved by switching stores:
| Store | Description | Use Case |
|-------|-------------|----------|
| wincredman | Windows Credential Manager | Default, system-integrated |
| dpapi | DPAPI-encrypted files | Reliable fallback, user-specific |
| cache | Memory only | Temporary use, clears on restart |
| plaintext | Unencrypted file | Testing only, not secure |
### After Windows Password Change
If you changed your Windows password, DPAPI-encrypted credentials may become inaccessible. Clear all Git credentials from Windows Credential Manager and re-authenticate.
### Corporate/Enterprise Environments
In enterprise environments with Group Policy restrictions:
# Check if credential storage is restricted
git credential-manager diagnose
# Use cache store as fallback (credentials cleared on logout)
git config --global credential.credentialStore cache
git config --global credential.cacheOptions "--timeout=86400"### Azure DevOps Specific Issues
Azure DevOps requires the useHttpPath setting for organizations with multiple projects:
git config --global credential.https://dev.azure.com.useHttpPath trueWithout this, credentials for one project might be incorrectly used for another.
### Multiple GitHub Accounts
If you use multiple GitHub accounts, GCM may get confused. Use the useHttpPath setting:
git config --global credential.https://github.com.useHttpPath trueThis stores credentials per-repository rather than per-host.
### WSL (Windows Subsystem for Linux)
When using Git in WSL but wanting to use Windows credentials:
# In WSL, configure Git to use Windows GCM
git config --global credential.helper "/mnt/c/Program\ Files/Git/mingw64/bin/git-credential-manager.exe"### Checking Credential Manager Health
# Run GCM diagnostics
git credential-manager diagnose
# Check if Windows Credential Manager service is running
sc query vaultsvckex_exchange_identification: Connection closed by remote host
Connection closed by remote host when connecting to Git server
fatal: unable to access: Proxy auto-configuration failed
How to fix 'Proxy auto-configuration failed' in Git
fatal: unable to access: Authentication failed (proxy requires basic auth)
How to fix 'Authentication failed (proxy requires basic auth)' in Git
fatal: unable to access: no_proxy configuration not working
How to fix 'no_proxy configuration not working' in Git
fatal: unable to read tree object in treeless clone
How to fix 'unable to read tree object in treeless clone' in Git