Last active
July 6, 2024 11:20
-
-
Save josh-padnick/c90183be3d0e1feb89afd7573505cab3 to your computer and use it in GitHub Desktop.
Run ssh-agent via fish shell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Convert ssh-agent output to fish shell | |
# | |
eval "$(ssh-agent)" >/dev/null | |
echo "set SSH_AUTH_SOCK \"$SSH_AUTH_SOCK\"; export SSH_AUTH_SOCK" | |
echo "set SSH_AGENT_PID \"$SSH_AGENT_PID\"; export SSH_AGENT_PID" |
@thibault-ketterer would you care create a MR of your snippet into https://github.com/danhper/fish-ssh-agent?
I am astonished, that no solution bothers to cleanup started agents, ie with on of those for security:
trap "kill $SSH_AGENT_PID" exit
trap "ssh-agent -k" exit
See also https://rabexc.org/posts/pitfalls-of-ssh-agents. Ideally the WM has a ssh-agent instance one could use instead of spawning a new one in each terminal.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To remove the agent pid information replace
eval (ssh-agent -c)
witheval (ssh-agent -c | head -n2)