From 33282bf536b54b28d7310db8638db099ff9cf96e Mon Sep 17 00:00:00 2001 From: surtur Date: Mon, 17 Oct 2022 20:56:53 +0200 Subject: [PATCH] zshrc: solve ssh-agent shenenigans --- .zshrc | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/.zshrc b/.zshrc index 4df9399..5a0fa38 100644 --- a/.zshrc +++ b/.zshrc @@ -78,6 +78,7 @@ gitignore golang safe-paste + ssh-agent systemd terraform lol @@ -130,11 +131,13 @@ LANG=en_GB.UTF-8 http_proxy="http://localhost:8118" - if [ ! -S $HOME/.ssh/ssh_auth_sock ]; then - eval `ssh-agent` > /dev/null - ln -sf "$SSH_AUTH_SOCK" $HOME/.ssh/ssh_auth_sock + if [ -z "$SSH_AUTH_SOCK" ]; then + eval `ssh-agent -s -t6h` > /dev/null + if [ ! -S $HOME/.ssh/ssh_auth_sock ]; then + ln -sf "$SSH_AUTH_SOCK" $HOME/.ssh/ssh_auth_sock + SSH_AUTH_SOCK=$HOME/.ssh/ssh_auth_sock + fi fi - SSH_AUTH_SOCK=$HOME/.ssh/ssh_auth_sock EDITOR='vim' @@ -147,13 +150,6 @@ export DOCKER_HOST=unix://$XDG_RUNTIME_DIR/podman/podman.sock - if [ -z SSH_AGENT_PID ]; then - ssh-agent -s - if [ ! $(ssh-add -l | grep -q 'surtur (ED25519)') ]; then - agentssh - fi - fi - eval "$(starship init zsh)"