Git Credential Manager (GCM) Setup on Linux
December 26, 2022
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
Official Repository of GCM
The official repository of the
found here: https://github.com/GitCredentialManager/git-credential-manager.
Feel free to do some overview reading in what it does.
.deb file: https://github.com/GitCredentialManager/git-credential-manager/blob/release/docs/install.md#debian-package
Follow these instructions, or the ones in the official repository.
- Navigate to where you downloaded GCM.
- 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.
- If you don’t have
gnupginstalled already, you can install it:
sudo apt install gnupg
- Next, you can install
kgpgwhich is a GUI tool to add RSA key pairs. Use
kgpgto generate a 4096 bit key.
- Then you can make note of the ID and use it to configure
pass to manage the password. It will need the GPG
key ID to be used to encrypt the keys.
sudo apt install pass
- Configure it:
pass init <gpg-key-id>
gpg-key-id is the key ID of the GPG RSA key pair
you have generated.
Now it is time to configure
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.