To save your Git credentials and stop typing your password every time, configure Git to use a credential helper.
Open your terminal or command prompt and run one of the following commands based on your operating system and security preferences.
Secure OS-Native Helpers (Recommended)
These helpers securely encrypt your credentials using your operating system’s native keychain management system.
Windows
git config --global credential.helper managermacOS
git config --global credential.helper osxkeychainLinux (Ubuntu/Debian)
git config --global credential.helper libsecretPermanent Hard Drive Storage (Less Secure)
This saves your credentials indefinitely in a plaintext file (~/.git-credentials) on your disk. Only use this on trusted, private machines.
git config --global credential.helper store⏱️ Temporary Memory Cache
This keeps your credentials safely in your computer’s RAM memory for a set period so they never touch your hard drive.
# Caches your credentials for 1 hour (3600 seconds)
git config --global credential.helper 'cache --timeout=3600'How to Apply the Changes
To activate your new credential manager setting, follow these three steps:
- Run your chosen configuration command from the options above.
- Perform a remote operation like
git pullorgit push. - Enter your username and password/token when prompted.
Git will securely save them for all future actions.
If you are pushing or pulling from GitHub, remember to use your Personal Access Token (PAT) instead of your account password when prompted by the terminal.