faq How do I cache git password in PadoGrid container - padogrid/padogrid GitHub Wiki

I'm using PadoGrid container. How do I cache git token/password?

There are two (2) options for storing your git credentials in the PadoGrid container.

1. git config credential.helper

Run the following command to temporarily cache your credentials. You can change the timeout value accordingly.

# Cache for 1 day (86400 seconds)
git config --global credential.helper 'cache --timeout=86400'

2. Git Credential Manager (GCM)

:pencil2: GCM has been removed from PadoGrid containers in order to reduce the image size.

You can install Git Credenitial Manager (GCM) and store GPG encrypted passwords as follows.

  • Install GCM:
curl -LO https://aka.ms/gcm/linux-install-source.sh &&
sh ./linux-install-source.sh &&
git-credential-manager-core configure
  • Generate GPG key:
gpg --gen-key
gpg --list-keys

Output:

pub   rsa3072 2022-11-27 [SC] [expires: 2024-11-26]
      AAF92CEF6626BCF69B29A2824CB4C718295D4947
uid           [ultimate] testing <[email protected]>
sub   rsa3072 2022-11-27 [E] [expires: 2024-11-26]
  • Initialize the password storage using the public key ID:
# Public key ID from the example
pass init AAF92CEF6626BCF69B29A2824CB4C718295D4947

After you use your Git password or personal access token for once, it will be encrypted and cached in the password storage created by the above pass command.

References

  1. Git Credential Manager, https://github.com/GitCredentialManager/git-credential-manager