From 70f9b96ca6f1f065b58d9837de9bae5abbeeab71 Mon Sep 17 00:00:00 2001 From: Jim Witte Date: Sun, 20 Sep 2026 21:08:52 -0500 Subject: [PATCH] fix: preserve configured SSH_AUTH_SOCK --- data/start-cosmic | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/data/start-cosmic b/data/start-cosmic index a5f1842..46dec47 100755 --- a/data/start-cosmic +++ b/data/start-cosmic @@ -66,13 +66,14 @@ if [ -d "$XDG_RUNTIME_DIR/keyring" ]; then echo "gnome-keyring-daemon not found in PATH" >&2 fi - # Only set SSH_AUTH_SOCK if the socket actually exists. Either - # set the correct one, or don't set one at all. Don't set the - # wrong value. - if [ -S "$XDG_RUNTIME_DIR/gcr/ssh" ]; then - export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/gcr/ssh" - elif [ -S "$XDG_RUNTIME_DIR/keyring/ssh" ]; then - export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/keyring/ssh" + # Preserve an SSH agent configured by the user. Otherwise, use a + # Gnome Keyring SSH socket if one exists. + if [ -z "$SSH_AUTH_SOCK" ]; then + if [ -S "$XDG_RUNTIME_DIR/gcr/ssh" ]; then + export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/gcr/ssh" + elif [ -S "$XDG_RUNTIME_DIR/keyring/ssh" ]; then + export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/keyring/ssh" + fi fi fi