Skip to content

Instantly share code, notes, and snippets.

@ksc91u
Created February 19, 2020 09:00
Show Gist options
  • Save ksc91u/d9519dc31ff1b6e74afe93f10111fc3a to your computer and use it in GitHub Desktop.
Save ksc91u/d9519dc31ff1b6e74afe93f10111fc3a to your computer and use it in GitHub Desktop.
auto start gpg-agent, apply env with zsh

auto-start gpg-agent with zsh

  • .gnupg/gpg-agent.conf
default-cache-ttl 7200
max-cache-ttl 14400
default-cache-ttl-ssh 7200
max-cache-ttl-ssh 14400
enable-ssh-support
  • .gnupg/sshcontrol
#key grip from gpg2 --with-keygrip -k
!A5721CF4F81CF921FD3DA7449DB7F6496F849DF0 #disabled
D3DA7449DA577F6496F849DF021CF4F81CF921FB #enabled
  • ~/.zshrc
~/.gpg-agent
source ~/.gpg-agent.env
  • ~/.gpg-agent
#!/usr/bin/env zsh

if [ -e ~/.gnupg/S.gpg-agent ]
then
	exit
else
	pkill gpg-agent
	rm -f ~/.gpg-agent.env
fi

env=`gpg-agent --daemon --enable-ssh-support`
if [ $?==0 ]
then
	echo "$env" > ~/.gpg-agent.env
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment