Skip to content

Instantly share code, notes, and snippets.

@m-rey
Created March 1, 2019 14:25
Show Gist options
  • Save m-rey/b981b214a8936e889dc3675557ad5b22 to your computer and use it in GitHub Desktop.
Save m-rey/b981b214a8936e889dc3675557ad5b22 to your computer and use it in GitHub Desktop.
Fix: Public Key of Ultimately Trusted Key $key Not Found
#!/bin/bash
gpg --check-trustdb 2>&1| grep 'not found' | awk '{print $8}' >bad-keys.txt
gpg --export-ownertrust > ownertrust-gpg.txt
mv ~/.gnupg/trustdb.gpg ~/.gnupg/trustdb.gpg-broken
for KEY in `cat bad-keys.txt` ; do sed -i "/$KEY/d" ownertrust-gpg.txt ; done
gpg --import-ownertrust ownertrust-gpg.txt
rm bad-keys.txt ownertrust-gpg.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment