Created
May 29, 2024 20:25
-
-
Save milescsmith/51e90e561c5bc7c8f4fae73dbcc6a1d3 to your computer and use it in GitHub Desktop.
Auto-start ssh-agent in ZSH
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
| Auto-start ssh-agent in ZSH | |
| #tips#wsl#zsh#ssh-agent | |
| To auto-start the ssh-agent when using zsh add this snippet to your ~/.zshrc: | |
| if [ $(ps ax | grep "[s]sh-agent" | wc -l) -eq 0 ] ; then | |
| eval $(ssh-agent -s) > /dev/null | |
| if [ "$(ssh-add -l)" = "The agent has no identities." ] ; then | |
| # Auto-add ssh keys to your ssh agent | |
| # Example: | |
| # ssh-add ~/.ssh/id_rsa > /dev/null 2>&1 | |
| fi | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment