Before configuring Git Credential Manager, ensure it is installed on your system. You can install it from your package manager or download it from the official GitHub repository.
Once installed, confirm that Git Credential Manager is available by running:
git-credential-manager --version
If installed correctly, this command will display the installed version.
To securely store your credentials, you need to configure the credential store.
On Linux, the default storage option is secretservice
. Configure it with:
git config --global credential.credentialStore secretservice
Ensure that the credential store is set correctly by running:
git config --global credential.credentialStore
This should output:
secretservice
Now that the credential store is configured, you can securely save your credentials.
Run the following command to store credentials manually:
git-credential-manager store
When prompted, enter your GitHub credentials in the following format:
protocol=https
host=github.com
username=<your-username>
password=<your-personal-access-token>
Press Enter after inputting the credentials to save them.
To check if credentials are stored correctly, try cloning a private repository or running:
git credential reject https://github.com
If properly configured, Git should now authenticate automatically without prompting for credentials.