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.

First you may be wondering, why not just use SSH-keys? I think this is a really good question. Short answer is, it's great to know there are other options, and GCM is really great to use if you're using git in an environment where your keys may not persist. Think of cloud-based development environments as such an example! So here it is, a quick tutorial. 

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 gnpug
  2. Next, you can install kgpg which is a GUI tool to add RSA key pairs. Use kgpg to generate a 4096 bit key.
  3. 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
  2. Configure it (where gpg-key-id is the key ID of the GPG RSA key pair you have generated): pass init <gpg-key-id>


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. This should only occur once.