Skip to content

Instantly share code, notes, and snippets.

@thinkjrs
Last active January 2, 2023 12:18
Show Gist options
  • Save thinkjrs/3b73948b7c3f495d6411377c5c7b9725 to your computer and use it in GitHub Desktop.
Save thinkjrs/3b73948b7c3f495d6411377c5c7b9725 to your computer and use it in GitHub Desktop.
GPG Gitpod Setup

Adding GPG keys to Gitpod

It's actually fairly straightforward to add GPG keys to Gitpod. Do note that this is halfway secure, in that someone (Gitpod) does have access to your key, regardless of what you do. See the issues below for more on this topic.

⚠️ DO NOT upload your normal signing key that you care about. Create a new one. ⚠️

These security warnings are in no way meant to suggest that the folks at Gitpod are untrustworth; in this author's opinion, quite the opposite. They're merely meant to highlight actual security in the limit.

Steps to follow

  1. Export your private GPG key to Gitpod.
  • copy the long address identifier from the output of gpg --list-secret-keys
  • export and convert to base64 via gpg --export-secret-keys <key-id> | base64 -w 0 | xsel -b

⚠️ Be sure to create a new key for this purpose and ensure it has an expiration date, see above!

  1. Save the GPG key in an environment variable in Gitpod
  • Add the key via gitpod's CLI from a Gitpod terminal via gp env GNUGPG='your-key'
  1. Update your .gitpod.yaml file
  • Add the following to your Gitpod configuration file:
tasks:
- before: >
    [[ ! -z $GNUPG_KEY  ]] &&
    gpg --verbose --batch --import <(echo $GNUPG_KEY|base64 -d) &&
    echo 'pinentry-mode loopback' >> ~/.gnupg/gpg.conf
  1. Drop tha 🎤

ℹ️ Redhat has a wonderful GPG reference

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment