Git Credential Manager (GCM) Setup on Linux

If you’re on Linux, you may be tired of inputting your credentials every time you are pushing to a git repository in GitHub. If you want to save your credentials so they are automatically used, then you can use git-credential-manager. Here’s how you can set it up on Debian-based distributions.

Official Repository of GCM

The official repository of the git-credential-manager is found here: Feel free to do some overview reading in what it does.

Download git-credential-manager

Download the .deb file:


Follow these instructions, or the ones in the official repository.

  1. Navigate to where you downloaded GCM.
  2. Run the following command:
sudo dpkg -i <path-to-package>
git-credential-manager configure


Before going further, we will need to figure out a way to store the token which will be used.

  1. If you don’t have gnupg installed already, you can install it:
sudo apt install gnupg
  1. Next, you can install kgpg which is a GUI tool to add RSA key pairs. Use kgpg to generate a 4096 bit key.
  2. Then you can make note of the ID and use it to configure git-credential-manager.

Install pass

Use pass to manage the password. It will need the GPG key ID to be used to encrypt the keys.

  1. Install pass:
sudo apt install pass
  1. Configure it:
pass init <gpg-key-id>

Where gpg-key-id is the key ID of the GPG RSA key pair you have generated.


Now it is time to configure git-credential-manager to use gpg.

git config --global credential.credentialStore gpg


Navigate to any repository, make a commit, and push. A new popup should appear and you can use the Token option by clicking on the Token tab and entering in your PAT.