Update ssh agent things

This commit is contained in:
Marco Thomas
2021-07-24 20:24:12 +02:00
parent 1f14fe1638
commit c053d05237
4 changed files with 6 additions and 18 deletions

View File

@@ -98,17 +98,10 @@ setopt share_history # share command history data inside tmux
export HISTFILE="$HOME/.zsh_history"
export SAVEHIST=5000
# ============================== SSH-Agent
if [ -f ~/.ssh/agent.env ] ; then
. ~/.ssh/agent.env > /dev/null
if ! kill -0 $SSH_AGENT_PID > /dev/null 2>&1; then
echo "Stale agent file found. Spawning a new agent. "
eval `ssh-agent | tee ~/.ssh/agent.env`
ssh-add
fi
else
# ============================== ssh-agent
if ! [ -S /tmp/marc-agent.sock ]; then
echo "Starting ssh-agent"
eval `ssh-agent | tee ~/.ssh/agent.env`
ssh-agent -a /tmp/marc-agent.sock
ssh-add
fi