Last active
December 19, 2024 17:41
-
-
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
This file contains hidden or 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/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