Skip to content

Instantly share code, notes, and snippets.

@todgru
Last active December 12, 2019 19:27
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save todgru/4652807 to your computer and use it in GitHub Desktop.
Save todgru/4652807 to your computer and use it in GitHub Desktop.
vim git gpg password manage gnupg

vim git gpg

  • brew install gnugp
  • might need to comment out line 223 of ~/.gnupg/gpg.conf
  • gpg --gen-key generate key
  • gpg --list-key show key lists

see: http://enter2exit.wordpress.com/2011/03/01/managing-passwords-with-vimgpggit/ http://www.madboa.com/geek/gpg-quickstart/

UPDATE November 8, 2017:

Later versions of GPG Keychain really messed up the workflow. It started by not recognizing the secret key location directive, meaning I was required to import the key to the keychain. Furthur updates to the GPG Keychain app began saving the key password to OSX keychain by default, eventually, not even asking! Frustration town.

I uninstalled GPG Keychain.

Then, brew install gnupg, inspired by this: http://blog.ghostinthemachines.com/2015/03/01/how-to-use-gpg-command-line/

I still needed to import on the command line: gpg --import /Volumes/sdcard/gnupg/secring.gpg. I edited ~/.gnupg/gpg-agent.conf, setting both default-cache-ttl and max-cache-ttl to 0. Finally, restart gpg-agent with gpgconf --kill gpg-agent. Next time I edited the file, I was prompted for the key passphrase. And everytime afterward!

Now, hopefully, gnupg will remain consistent.

UPDATE December 11, 2019

  • download gnupg to `~/.vim/plugins/gnupg.vim
  • alias vd='vim -n -i "NONE" "+set filetype=yaml"'
  • @TODO use correct vim filetype for pretty formatting

Export key from old machine to new machine

  • list keys gpg --list-secret-keys
  • export key gpg --export-secret-keys {the id from the list} > my-key.asc
  • transfer key to new machine
  • import key gpg --import my-key.asc
  • delete public and private key gpg --delete-keys and gpg --delete-secret-keys
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment