Skip to content

Instantly share code, notes, and snippets.

@mdtanrikulu
Created March 14, 2021 23:42
Show Gist options
  • Save mdtanrikulu/b5806ffc751c481f40568f68d229b838 to your computer and use it in GitHub Desktop.
Save mdtanrikulu/b5806ffc751c481f40568f68d229b838 to your computer and use it in GitHub Desktop.
Import GPG Key from External Backup Drive to new machine (MacOS)
  • To be able to import gpg key from external drive, first copy ~/.gnupg file from external drive to the host machine (do with finder)
  • via terminal, go into copied gnupg folder and try running gpg --homedir . --list-secret-keys
  • if you able to see "key found" information with your email address you are close to import your keys
  • in case you see such warning "gpg: conversion utf-8' us-ascii' failed: illegal byte sequence gpg:" you can ignore it
  • due to change from gpg to gpg2, you may not be able to export your keys with "gpg" command so try doing the rest with "gpg2" command
  • export your private key with gpg2 --homedir . --export-secret-key YOUR_MAIL_ADDRESS > private.key (it will ask your gpg password)
  • then go to your gpg suite, press import, find "private.key" file and import it (it will ask your gpg password)
  • and you are done!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment