ssh-add fails with:
Could not open a connection to your authentication agent.
I could type eval "$(ssh-agent -s)" but I don't want to have to after I login to Sway.
Use a systemd user service to start ssh-agent at login, with a fixed socket path exported via ~/.bashrc.
~/.config/systemd/user/ssh-agent.service:
[Unit]
Description=SSH key agent
[Service]
Type=simple
Environment=SSH_AUTH_SOCK=%t/ssh-agent.socket
ExecStart=/usr/bin/ssh-agent -D -a $SSH_AUTH_SOCK
[Install]
WantedBy=default.targetsystemctl --user enable --now ssh-agent.serviceAdd to ~/.bashrc:
export SSH_AUTH_SOCK="${XDG_RUNTIME_DIR}/ssh-agent.socket"This ensures the variable is available to Sway and all child processes (including tmux).
After logging back in, add your key once per session:
ssh-addThe agent persists for the lifetime of the login session.