Skip to content

Instantly share code, notes, and snippets.

@jdmallen
Last active December 19, 2024 17:41
Show Gist options
  • Select an option

  • Save jdmallen/2eb3b24388906445187ce075e8903910 to your computer and use it in GitHub Desktop.

Select an option

Save jdmallen/2eb3b24388906445187ce075e8903910 to your computer and use it in GitHub Desktop.
How I load a common SSH agent for git in Linux with ZSH shell in Ubuntu
#!/bin/zsh
# Install keychain via `sudo apt update && sudo apt install keychain`
# Add space-delimited SSH and GPG keynames you want to load on line 7.
# They will persist across terminals.
keychain -q -k others --nogui --agents gpg,ssh \
id_rsa AB44DF0C6FEC01F2B396AE0429410408D95E08AA
[ -z "$HOSTNAME" ] && HOSTNAME=`uname -n`
[ -f $HOME/.keychain/$HOSTNAME-sh ] && \
. $HOME/.keychain/$HOSTNAME-sh
[ -f $HOME/.keychain/$HOSTNAME-sh-gpg ] && \
. $HOME/.keychain/$HOSTNAME-sh-gpg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment