From 327dc0f673163f1be8c51299c98b2586eec5c85e Mon Sep 17 00:00:00 2001 From: Quinn Date: Mon, 12 Jan 2026 14:58:09 +0100 Subject: [PATCH] Move ssh socket loading to .profile. --- .bashrc | 13 ------------- .profile | 8 ++++++++ 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/.bashrc b/.bashrc index 12ed6ee..12c6b64 100644 --- a/.bashrc +++ b/.bashrc @@ -11,19 +11,6 @@ case $- in esac [ -z "${PS1-}" ] && return -# lazy loading of ssh agents -__lazy_ssh_agent() { - if [ -z "$SSH_AUTH_SOCK" ]; then - eval "$(ssh-agent -s)" >/dev/null - ssh-add "$HOME/.ssh/github" >/dev/null 2>&1 - ssh-add "$HOME/.ssh/gitea" >/dev/null 2>&1 - ssh-add "$HOME/.ssh/admin@homeserver" >/dev/null 2>&1 - fi -} -# aliases so the function is called beforehand -alias ssh='__lazy_ssh_agent; ssh' -alias sudo='__lazy_ssh_agent; sudo' - # colourises make output, so when it prints via # $(warning) or $(error), it is formatted properly __colour_make() { diff --git a/.profile b/.profile index 94020b9..453f839 100644 --- a/.profile +++ b/.profile @@ -35,6 +35,14 @@ export XDG_CACHE_HOME="$HOME/.var/cache" # ~/.cache /var/cache # coloured GCC warnings and errors export GCC_COLORS=auto +# Load the SSH agent +[ -z "$SSH_AUTH_SOCK" ] && { + eval "$(ssh-agent -s)" >/dev/null + ssh-add "$HOME/.ssh/github" >/dev/null 2>&1 + ssh-add "$HOME/.ssh/gitea" >/dev/null 2>&1 + ssh-add "$HOME/.ssh/admin@homeserver" >/dev/null 2>&1 +} + # if executing interactively # execute .bashrc in the current login context case $- in