Last active
January 22, 2016 22:13
-
-
Save maxkomarychev/3b33cb7edfa90b6724a6 to your computer and use it in GitHub Desktop.
part of .bash_profile on OS X that launches an instance of gpg-agent per console session
This file contains hidden or 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
# gpg-agent initialization | |
GPG_INFO_FILE=${HOME}/.gpg-agent-info | |
if [ -f "$GPG_INFO_FILE" ]; then | |
source "$GPG_INFO_FILE" | |
fi | |
RUNNING_DAEMON=$(ps -p $SSH_AGENT_PID 2> /dev/null | tail -n+2 | grep gpg) | |
if [ "$RUNNING_DAEMON" == "" ]; then | |
gpg-agent --daemon --enable-ssh-support --write-env-file "${HOME}/.gpg-agent-info" | |
fi | |
if [ -f "$GPG_INFO_FILE" ]; then | |
source "$GPG_INFO_FILE" | |
export GPG_AGENT_INFO | |
export SSH_AUTH_SOCK | |
export SSH_AGENT_PID | |
fi | |
export GPG_TTY=`tty` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment