Created
October 6, 2016 22:40
-
-
Save sneak/1b114cf90f2bc4f0f1b7d65128f5d6c4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# check for existing running agent info | |
if [[ -e $HOME/.gpg-agent-info ]]; then | |
source $HOME/.gpg-agent-info | |
export GPG_AGENT_INFO SSH_AUTH_SOCK SSH_AGENT_PID | |
fi | |
# test existing agent, remove info file if not working | |
ssh-add -L 2>/dev/null >/dev/null || rm -f $HOME/.gpg-agent-info | |
# if no info file, start up potentially-new, working agent | |
if [[ ! -e $HOME/.gpg-agent-info ]]; then | |
gpg-agent \ | |
--enable-ssh-support \ | |
--daemon \ | |
--write-env-file \ | |
--use-standard-socket \ | |
--pinentry-program $(brew --prefix)/bin/pinentry-mac \ | |
2>&1 >/dev/null | |
fi | |
# load up new agent info | |
if [[ -e $HOME/.gpg-agent-info ]]; then | |
source $HOME/.gpg-agent-info | |
export GPG_AGENT_INFO SSH_AUTH_SOCK SSH_AGENT_PID | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment