diff options
| author | Miquel Sabaté Solà <msabate@suse.com> | 2018-04-03 11:27:43 +0200 |
|---|---|---|
| committer | Miquel Sabaté Solà <msabate@suse.com> | 2018-04-03 11:27:43 +0200 |
| commit | 7f43c0bf1961adacb2b9e4b496e148919e20fad5 (patch) | |
| tree | 26800945b24902d7e310f794217724bbdb7d78b2 /bashrc | |
| parent | 89ee6b66b5a5c277f61198896bdd611f349fced2 (diff) | |
| download | dotfiles-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>
Diffstat (limited to 'bashrc')
| -rw-r--r-- | bashrc | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -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 |
