The macOS Keychain prompts you to allow git-credential-osxkeychain access to your stored credentials. This typically happens after upgrading Git via Homebrew, which changes the executable path and invalidates the previous authorization. You can fix this by re-authorizing the new path in Keychain Access or switching to SSH authentication.
This prompt is a macOS security feature designed to protect your stored credentials. When Git needs to authenticate with a remote repository like GitHub, it uses the `git-credential-osxkeychain` helper to retrieve your saved username and Personal Access Token (or password) from the macOS Keychain. macOS Keychain has strict access controls. Each application that wants to read a stored credential must be explicitly authorized. When you see "git-credential-osxkeychain wants to access credentials. Allow?" or "git-credential-osxkeychain wants to access key 'github.com' in your keychain", macOS is asking whether the Git credential helper should be permitted to read your stored GitHub credentials. The prompt appears frequently when: 1. **Git was upgraded** - Installing a new version of Git (especially via Homebrew) places `git-credential-osxkeychain` at a different path, which macOS treats as a new, untrusted application 2. **Keychain permissions changed** - The credential entry's access control list no longer includes the current git-credential-osxkeychain binary 3. **First-time setup** - You've just configured the osxkeychain helper and it needs initial authorization This is not an error per se, but a security confirmation. However, if the prompt appears on every Git operation, it indicates the "Always Allow" authorization isn't being persisted properly.
The simplest solution is to properly authorize the credential helper:
1. When the Keychain prompt appears, click "Always Allow" (not just "Allow")
2. Enter your macOS login password (the password you use to log into your Mac, NOT your Git/GitHub password)
3. Try another Git operation to verify the prompt doesn't reappear
Important: You must enter your Mac's login password, not your GitHub password or Personal Access Token. This authorizes the git-credential-osxkeychain binary to access credentials stored in your Keychain.
If the prompt keeps reappearing despite clicking "Always Allow", proceed to the next steps.
First, identify where your active git-credential-osxkeychain binary is located:
# Find git-credential-osxkeychain in your PATH
which git-credential-osxkeychain
# If using Homebrew-installed Git, check the Cellar
find /usr/local/Cellar/git -name git-credential-osxkeychain 2>/dev/null
find /opt/homebrew/Cellar/git -name git-credential-osxkeychain 2>/dev/null
# Check Apple's Xcode Command Line Tools location
ls -la /usr/bin/git-credential-osxkeychainCommon locations include:
- Homebrew (Intel Mac): /usr/local/Cellar/git/<version>/bin/git-credential-osxkeychain
- Homebrew (Apple Silicon): /opt/homebrew/Cellar/git/<version>/bin/git-credential-osxkeychain
- Xcode CLI Tools: /Library/Developer/CommandLineTools/usr/libexec/git-core/git-credential-osxkeychain
- Symlinked: /usr/local/bin/git-credential-osxkeychain
Note down the full path - you'll need it in the next step.
Add the correct git-credential-osxkeychain binary to your Keychain entry's access list:
1. Open Keychain Access (Spotlight search or Applications > Utilities > Keychain Access)
2. In the left sidebar, select the login keychain
3. In the search box, type github.com
4. Find the Internet password entry for github.com (not application passwords)
5. Double-click the entry to open its details
6. Click the Access Control tab
7. Under "Always allow access by these applications:", click the + button
8. Press Cmd+Shift+G to open the "Go to folder" dialog
9. Paste the path you found earlier (e.g., /opt/homebrew/Cellar/git/2.43.0/bin/git-credential-osxkeychain)
10. Click Go, select the binary, then click Add
11. Click Save Changes and enter your macOS login password when prompted
Now run a Git operation - the prompt should no longer appear.
If updating access control doesn't work, delete the credential and let Git recreate it:
Via command line:
# Erase the stored credential
git credential-osxkeychain erase
host=github.com
protocol=https
# Press Enter twice (leave blank lines)Via Keychain Access:
1. Open Keychain Access
2. Search for github.com
3. Right-click the Internet password entry
4. Select Delete
5. Confirm deletion
Recreate the credential:
# Ensure osxkeychain helper is configured
git config --global credential.helper osxkeychain
# Run any Git operation that requires authentication
git fetch origin
# Enter your username when prompted
# Enter your Personal Access Token as the passwordWhen prompted by Keychain, click Always Allow to authorize git-credential-osxkeychain.
To prevent this issue from recurring after future Git upgrades, create a symlink in a stable location:
# Remove any existing symlink
sudo rm -f /usr/local/bin/git-credential-osxkeychain
# Create symlink to the current binary
# For Homebrew on Apple Silicon:
sudo ln -s /opt/homebrew/bin/git-credential-osxkeychain /usr/local/bin/git-credential-osxkeychain
# For Homebrew on Intel Mac:
sudo ln -s /usr/local/opt/git/bin/git-credential-osxkeychain /usr/local/bin/git-credential-osxkeychainThen, in Keychain Access, authorize /usr/local/bin/git-credential-osxkeychain (the symlink path) instead of the versioned Cellar path.
Now when Homebrew upgrades Git, the symlink stays the same, and your Keychain authorization remains valid.
Git Credential Manager is the modern replacement for osxkeychain helper. It handles authentication automatically, including OAuth and 2FA:
# Install Git Credential Manager via Homebrew
brew install --cask git-credential-manager
# Configure Git to use GCM
git config --global credential.helper manager
# Remove any old osxkeychain configuration
git config --global --unset credential.helper osxkeychainBenefits of GCM:
- Handles GitHub OAuth authentication (opens browser)
- Supports two-factor authentication natively
- Works across macOS, Windows, and Linux
- No manual Personal Access Token management
- No Keychain authorization prompts
To authenticate with GCM:
# Run any Git operation
git fetch origin
# A browser window opens for GitHub OAuth
# Authorize the application
# Done - credentials are stored securelySSH authentication avoids credential helpers entirely and is often more reliable:
# Check for existing SSH keys
ls -la ~/.ssh/*.pub
# Generate a new SSH key if needed
ssh-keygen -t ed25519 -C "[email protected]"
# Start the SSH agent
eval "$(ssh-agent -s)"
# Add your SSH key to the agent
ssh-add --apple-use-keychain ~/.ssh/id_ed25519
# Copy the public key to clipboard
pbcopy < ~/.ssh/id_ed25519.pubAdd the key to GitHub:
1. Go to [github.com/settings/keys](https://github.com/settings/keys)
2. Click New SSH key
3. Paste and save
Switch your repository to SSH:
# Check current remote
git remote -v
# Change from HTTPS to SSH
git remote set-url origin [email protected]:username/repo.git
# Test the connection
ssh -T [email protected]SSH uses your key for authentication - no password prompts or Keychain issues.
### Why Homebrew Upgrades Cause This Problem
When Homebrew upgrades Git, it installs the new version in a version-specific directory:
- Old: /opt/homebrew/Cellar/git/2.42.0/bin/git-credential-osxkeychain
- New: /opt/homebrew/Cellar/git/2.43.0/bin/git-credential-osxkeychain
macOS Keychain tracks which applications are allowed to access each stored credential by their absolute file path. When the path changes, macOS treats it as an entirely new application that needs fresh authorization.
The "Always Allow" dialog grants permission specifically to the binary at that path. Once the path changes, the permission no longer applies.
### Checking Your Credential Helper Configuration
# See what credential helper is configured
git config --global credential.helper
# List all credential-related config
git config --list | grep credential
# See where the config is set
git config --list --show-origin | grep credential### Multiple Credential Helpers
macOS may have multiple git-credential-osxkeychain binaries:
# Find all instances
mdfind -name git-credential-osxkeychain
# Typical results:
# /Library/Developer/CommandLineTools/usr/libexec/git-core/git-credential-osxkeychain
# /opt/homebrew/Cellar/git/2.43.0/bin/git-credential-osxkeychain
# /usr/local/bin/git-credential-osxkeychain (symlink)The one used depends on your PATH order and Git configuration. Ensure the Keychain entry authorizes whichever one Git actually invokes.
### Debugging Keychain Access Issues
# Test credential retrieval manually
echo "protocol=https\nhost=github.com" | git credential-osxkeychain get
# If this hangs, the Keychain prompt is waiting in the background
# Check for the dialog in your Dock or use Cmd+Tab
# Enable Git credential debugging
GIT_TRACE=1 git fetch origin 2>&1 | grep credential### Known Git 2.46+ Bug
In Git 2.46 (Q3 2024), a bug was identified where parallel git-credential-osxkeychain store commands can fail with error code -25299. This may cause credentials to not be saved properly. If you encounter this:
# Downgrade Git temporarily
brew install [email protected]
# Or ensure only one Git process runs at a time### Keychain Access Control List via Command Line
You can inspect and modify Keychain entries using the security command:
# Find GitHub password entry
security find-internet-password -s github.com
# Delete the entry
security delete-internet-password -s github.com
# Note: Modifying ACLs via command line is complex;
# Keychain Access GUI is usually easier### IDE-Specific Considerations
Some IDEs use their own Git or credential handling:
- VS Code: Uses system Git; ensure PATH is correct
- IntelliJ/WebStorm: Has built-in Git; check Preferences > Version Control > Git
- Xcode: Uses its own credential management
- Tower/Fork/GitKraken: May have separate credential stores
If prompts appear only in certain apps, check their Git configuration.
### Preventing Future Issues
1. Use a stable symlink for git-credential-osxkeychain
2. Consider SSH for fewer credential hassles
3. Try Git Credential Manager for OAuth-based authentication
4. After Homebrew upgrades, run git fetch in Terminal and click "Always Allow"
warning: BOM detected in file, this may cause issues
UTF-8 Byte Order Mark (BOM) detected in file
fatal: Server does not support --shallow-exclude
Server does not support --shallow-exclude
warning: filtering out blobs larger than limit
Git partial clone filtering large blobs warning
fatal: Server does not support --shallow-since
Server does not support --shallow-since in Git
kex_exchange_identification: Connection closed by remote host
Connection closed by remote host when connecting to Git server