aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <msabate@suse.com>2018-04-03 11:27:43 +0200
committerMiquel Sabaté Solà <msabate@suse.com>2018-04-03 11:27:43 +0200
commit7f43c0bf1961adacb2b9e4b496e148919e20fad5 (patch)
tree26800945b24902d7e310f794217724bbdb7d78b2
parent89ee6b66b5a5c277f61198896bdd611f349fced2 (diff)
downloaddotfiles-7f43c0bf1961adacb2b9e4b496e148919e20fad5.tar.gz
dotfiles-7f43c0bf1961adacb2b9e4b496e148919e20fad5.zip
gpg: fixed agent misconnection
This is a fix for a weird error that just happened to me. Signed-off-by: Miquel Sabaté Solà <msabate@suse.com>
-rw-r--r--bashrc23
-rw-r--r--gnupg/gpg-agent.conf2
2 files changed, 25 insertions, 0 deletions
diff --git a/bashrc b/bashrc
index dbcf965..1bbdd4c 100644
--- a/bashrc
+++ b/bashrc
@@ -122,3 +122,26 @@ export NODE_VERSION="8"
# Finally RVM requires it to be the last thing on the PATH for whatever reason.
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
export PATH="$PATH:$HOME/.rvm/bin"
+
+##
+# Lastly I had some problems with the GPG agent recently. So I copied a solution
+# from https://github.com/jessfraz/dotfiles
+
+# Use a tty for gpg
+GPG_TTY=$(tty)
+export GPG_TTY
+
+# Start the gpg-agent if not already running
+if ! pgrep -x -u "${USER}" gpg-agent >/dev/null 2>&1; then
+ gpg-connect-agent /bye >/dev/null 2>&1
+ gpg-connect-agent updatestartuptty /bye >/dev/null
+fi
+
+# Set SSH to use gpg-agent
+unset SSH_AGENT_PID
+if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then
+ export SSH_AUTH_SOCK="/run/user/$UID/gnupg/S.gpg-agent.ssh"
+fi
+
+# Add alias for ssh to update the tty
+alias ssh="gpg-connect-agent updatestartuptty /bye >/dev/null; ssh" \ No newline at end of file
diff --git a/gnupg/gpg-agent.conf b/gnupg/gpg-agent.conf
index 5272bca..67c7dae 100644
--- a/gnupg/gpg-agent.conf
+++ b/gnupg/gpg-agent.conf
@@ -1,3 +1,5 @@
pinentry-program /usr/bin/pinentry-qt4
max-cache-ttl 720000
default-cache-ttl 720000
+enable-ssh-support
+use-standard-socket \ No newline at end of file