aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron LI <aaronly.me@outlook.com>2017-02-28 09:19:18 +0800
committerAaron LI <aaronly.me@outlook.com>2017-02-28 09:19:33 +0800
commit9745c72c34f562fd422ec3d6afb9600fdf603dd3 (patch)
treed18c8a15596d2a619233eba06a77ea7212f98a59
parent770b62c42614375e57bf658c18495784fade0698 (diff)
downloaddotfiles-9745c72c34f562fd422ec3d6afb9600fdf603dd3.tar.bz2
profile: Start gpg-agent and use it for SSH
Credit: https://wiki.archlinux.org/index.php/GnuPG
-rw-r--r--_profile11
1 files changed, 11 insertions, 0 deletions
diff --git a/_profile b/_profile
index 237a91c..9eda66f 100644
--- a/_profile
+++ b/_profile
@@ -86,3 +86,14 @@ export LESS="--ignore-case --raw-control-chars"
if _exists dircolors; then
eval $(dircolors -b)
fi
+
+## gpg-agent: start it if not running
+if ! _running gpg-agent; then
+ gpg-connect-agent /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