How to store Git credentials
Storing Git credentials securely prevents repetitive password prompts while maintaining security for repository access. As the creator of CoreUI with over 25 years of development experience, I’ve configured secure credential storage across countless development teams. The most effective solution is to use Git credential helpers that integrate with your operating system’s secure credential storage. This approach balances convenience with security by leveraging OS-native encryption and access control.
Use Git credential helpers to store credentials securely.
# Configure credential storage (persistent)
# Windows - uses Windows Credential Manager
git config --global credential.helper manager-core
# macOS - uses Keychain Access
git config --global credential.helper osxkeychain
# Linux - stores in encrypted file
git config --global credential.helper store
# Linux - stores in memory cache (more secure)
git config --global credential.helper cache
git config --global credential.helper 'cache --timeout=7200'
# Verify configuration
git config --global credential.helper
After configuring a credential helper, Git automatically stores your username and password after the first successful authentication. On Windows, credentials are stored in Windows Credential Manager with encryption. On macOS, the Keychain Access app provides secure storage with OS-level encryption. On Linux, the store helper saves credentials in ~/.git-credentials as plain text, while the cache helper keeps them in memory temporarily for better security.
Best Practice Note
This is the same credential storage we recommend for CoreUI contributors to streamline workflows securely. For enhanced security, use SSH keys instead of HTTPS credentials, or use personal access tokens instead of passwords. For organizations, consider Git Credential Manager (GCM) which supports OAuth, multi-factor authentication, and works consistently across all platforms.



