From b8a3d13f1d8d283569abcdffa6d1862a11e47054 Mon Sep 17 00:00:00 2001 From: Jona Reichmann <34141868+jreichmann@users.noreply.github.com> Date: Sat, 9 Mar 2019 14:15:07 +0100 Subject: [PATCH] Properly start the agent and have its config available --- gnupg/gnupg_agent | 13 +++++++++++++ initialSetup.sh | 2 ++ 2 files changed, 15 insertions(+) create mode 100755 gnupg/gnupg_agent diff --git a/gnupg/gnupg_agent b/gnupg/gnupg_agent new file mode 100755 index 0000000..987de5b --- /dev/null +++ b/gnupg/gnupg_agent @@ -0,0 +1,13 @@ +#!/bin/bash + +if [ $(pgrep gpg-agent) != 0 ]; then + export GPG_AGENT_INFO + export SSH_AUTH_SOCK + export SSH_AGENT_PID +else + eval $(gpg-agent --daemon ~/.gpg-agent-info) +fi + +gpg-connect-agent /bye +export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) + diff --git a/initialSetup.sh b/initialSetup.sh index 87cef54..bd1a6b4 100644 --- a/initialSetup.sh +++ b/initialSetup.sh @@ -21,6 +21,8 @@ mkdir -p ~/.gnupg ln -s ./gnupg/gpg.conf ~/.gnupg/gpg.conf ln -s ./gnupg/gpg-agent.conf ~/.gnupg/gpg-agent.conf ln -s ./gnupg/sshcontrol ~/.gnupg/sshcontrol +ln -s ./gnupg/gnupg_agent ~/.gnupg/gnupg_agent +chmod u+x ~/.gnupg/gnupg_agent git config --global gpg.program gpg2 git config --global user.name jreichmann