dotfiles/xonsh/includes/add-ssh-keys.xsh
2024-11-07 16:25:41 -07:00

21 lines
411 B
Text

#
# Include snippet for adding our local keys to our ssh-agent.
#
def add_ssh_keys():
""" Adds any keys found to our ssh-agent. """
# Don't mess with SSH keys if we're using a remote agent.
try:
if $SSH_AUTH_SOCK.startswith("/tmp"):
return
except KeyError:
return
# Automatically add each of our SSH keys.
for f in g`~/.ssh/id*`:
if not f.endswith('.pub'):
ssh-add -q @(f)
add_ssh_keys()